
(function(window,document,Laya){
	var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;

	var BaseMaterial=laya.d3.core.material.BaseMaterial,BaseShape=laya.d3.core.particleShuriKen.module.shape.BaseShape;
	var BaseTexture=laya.webgl.resource.BaseTexture,BlinnPhongMaterial=laya.d3.core.material.BlinnPhongMaterial;
	var BoxShape=laya.d3.core.particleShuriKen.module.shape.BoxShape,Browser=laya.utils.Browser,Burst=laya.d3.core.particleShuriKen.module.Burst;
	var Button=laya.ui.Button,Camera=laya.d3.core.Camera,CircleShape=laya.d3.core.particleShuriKen.module.shape.CircleShape;
	var Color=laya.d3.math.Color,ColorOverLifetime=laya.d3.core.particleShuriKen.module.ColorOverLifetime,ConeShape=laya.d3.core.particleShuriKen.module.shape.ConeShape;
	var DesignPlugin=editor.DesignPlugin,DirectionLight=laya.d3.core.light.DirectionLight,EditerBoxColliderShape=laya.d3Editor.component.physics.EditerColliderShape.EditerBoxColliderShape;
	var EditerCameraScript=laya.d3Editor.component.EditerCameraScript,EditerCapsuleColliderShape=laya.d3Editor.component.physics.EditerColliderShape.EditerCapsuleColliderShape;
	var EditerConeColliderShape=laya.d3Editor.component.physics.EditerColliderShape.EditerConeColliderShape,EditerCylinderColliderShape=laya.d3Editor.component.physics.EditerColliderShape.EditerCylinderColliderShape;
	var EditerMeshColliderShape=laya.d3Editor.component.physics.EditerColliderShape.EditerMeshColliderShape,EditerPhysicsCollider=laya.d3Editor.component.physics.EditerPhysicsCollider;
	var EditerRigidbody3D=laya.d3Editor.component.physics.EditerRigidbody3D,EditerScene3D=laya.d3Editor.EditerScene3D;
	var EditerSphereColliderShape=laya.d3Editor.component.physics.EditerColliderShape.EditerSphereColliderShape;
	var Emission=laya.d3.core.particleShuriKen.module.Emission,Event=laya.events.Event,FrameOverTime=laya.d3.core.particleShuriKen.module.FrameOverTime;
	var Gradient=laya.d3.core.Gradient,GradientAngularVelocity=laya.d3.core.particleShuriKen.module.GradientAngularVelocity;
	var GradientColor=laya.d3.core.particleShuriKen.module.GradientColor,GradientDataInt=laya.d3.core.particleShuriKen.module.GradientDataInt;
	var GradientDataNumber=laya.d3.core.particleShuriKen.module.GradientDataNumber,GradientSize=laya.d3.core.particleShuriKen.module.GradientSize;
	var GradientVelocity=laya.d3.core.particleShuriKen.module.GradientVelocity,Handler=laya.utils.Handler,HemisphereShape=laya.d3.core.particleShuriKen.module.shape.HemisphereShape;
	var IDEAPIS=laya.ide.managers.IDEAPIS,IDEEvent=laya.ide.event.IDEEvent,Image=laya.ui.Image,Keyboard=laya.events.Keyboard;
	var Label=laya.ui.Label,Loader=laya.net.Loader,Mesh=laya.d3.resource.models.Mesh,MeshSprite3D=laya.d3.core.MeshSprite3D;
	var Notice=ide.managers.Notice,ObjectTools=laya.debug.tools.ObjectTools,PixelLineData=laya.d3.core.pixelLine.PixelLineData;
	var PixelLineSprite3D=laya.d3.core.pixelLine.PixelLineSprite3D,PointLight=laya.d3.core.light.PointLight,Quaternion$1=laya.d3.math.Quaternion;
	var RenderContext3D=laya.d3.core.render.RenderContext3D,RenderTexture=laya.d3.resource.RenderTexture,RenderableSprite3D=laya.d3.core.RenderableSprite3D;
	var RotationOverLifetime=laya.d3.core.particleShuriKen.module.RotationOverLifetime,Shader3D=laya.d3.shader.Shader3D;
	var ShuriKenParticle3D=laya.d3.core.particleShuriKen.ShuriKenParticle3D,ShurikenParticleMaterial=laya.d3.core.particleShuriKen.ShurikenParticleMaterial;
	var ShurikenParticleRenderer=laya.d3.core.particleShuriKen.ShurikenParticleRenderer,ShurikenParticleSystem=laya.d3.core.particleShuriKen.ShurikenParticleSystem;
	var SimpleShapeSprite3D=laya.d3Extend.worldMaker.SimpleShapeSprite3D,SizeOverLifetime=laya.d3.core.particleShuriKen.module.SizeOverLifetime;
	var SkinnedMeshSprite3D=laya.d3.core.SkinnedMeshSprite3D,SphereShape=laya.d3.core.particleShuriKen.module.shape.SphereShape;
	var SpotLight=laya.d3.core.light.SpotLight,Sprite=laya.display.Sprite,Sprite3D=laya.d3.core.Sprite3D,StartFrame=laya.d3.core.particleShuriKen.module.StartFrame;
	var Stat=laya.utils.Stat,Tab=laya.ui.Tab,TextInput=laya.ui.TextInput,Texture=laya.resource.Texture,Texture2D=laya.webgl.resource.Texture2D;
	var TextureSheetAnimation=laya.d3.core.particleShuriKen.module.TextureSheetAnimation,Transform3D=laya.d3.core.Transform3D;
	var TransformSprite3D=laya.d3Editor.TransformSprite3D,Vector2$1=laya.d3.math.Vector2,Vector3$1=laya.d3.math.Vector3;
	var Vector4$1=laya.d3.math.Vector4,VelocityOverLifetime=laya.d3.core.particleShuriKen.module.VelocityOverLifetime;
	var VertexMesh=laya.d3.graphics.Vertex.VertexMesh,Viewport=laya.d3.math.Viewport;
/**
*...
*@author ...
*/
//class laya.ide.designplugin.Editer3DUtils
var Editer3DUtils=(function(){
	function Editer3DUtils(){
		this._owner=null;
		this._angleToRandin=180 / Math.PI;
		this._plugins=["Camera","Scene3D","Sprite3D","DirectionLight","PointLight","SpotLight"];
		this._quaternion=new Quaternion$1();
		this._rotationEuler=new Vector3$1();
	}

	__class(Editer3DUtils,'laya.ide.designplugin.Editer3DUtils');
	var __proto=Editer3DUtils.prototype;
	__proto.setOwner=function(owner){
		this._owner=owner;
	}

	__proto.createSceneByJsonData=function(data){
		var childData=data.child;
		if (childData){
			this._owner.removeChildren(5);
			for (var i=0,n=childData.length;i < n;i++){
				var child=this.createSpriteByJsonData(childData[i]);
				this._owner.addChild(child);
			}
		}
	}

	__proto.saveCameraInfo=function(){
		var root=this._owner.treeData.root;
		if (!root.cameraInfo){
			root.cameraInfo={};
		};
		var p=this._owner.camera.transform.position;
		var r=this._owner.camera.transform.rotation;
		var cp=root.cameraInfo.position;
		var cr=root.cameraInfo.rotation;
		if (cp && cr){
			var i=0;
			p=p.elements;
			r=r.elements;
			for (i=0;i < 3;i++){
				cp[i]=p[i];
			}
			for (i=0;i < 4;i++){
				cr[i]=r[i];
			}
			}else{
			root.cameraInfo.position=[p.x,p.y,p.z];
			root.cameraInfo.rotation=[r.x,r.y,r.z,r.w];
		}
	}

	__proto.createSpriteByJsonData=function(data){
		var obj;
		var props=data.props;
		var key;
		if (props.preset){
			props={};
			obj=data.props;
			for (key in obj){
				props[key]=obj[key];
			}
			obj=laya.editor.manager.PreFabManager.I.getPreFabByNode(data).props;
			for (key in obj){
				if (props[key]==undefined)
					props[key]=obj[key];
			}
		}
		if (props.prefabPath){
			if (!props.preset){
				props={};
				obj=data.props;
				for (key in obj){
					props[key]=obj[key];
				}
			}
			obj=PrefabManager.I.getPreFabByNode(data,props,laya.ide.designplugin.Editer3DUtils.I._owner.designer['isPrefabFile']);
			if (obj){
				obj=obj.props;
				if (PrefabManager.I.isFresh){
					PrefabManager.I.isFresh=false;
					this._owner.fresh();
					laya.editor.manager.ShortcutManager.exeKey(83,true);
				}
				for (key in obj){
					if (props[key]==undefined)
						props[key]=obj[key];
				}
			}
		};
		var sprite3d;
		switch (data.type){
			case "Sprite3D":
				sprite3d=new Sprite3D();
				sprite3d._parse(props);
				break ;
			case "MeshSprite3D":
				sprite3d=this.createMeshSprite3D(props);
				break ;
			case "SkinnedMeshSprite3D":
				sprite3d=this.createSkinnedMeshSprite3D(props);
				break ;
			case "ShuriKenParticle3D":
				sprite3d=this.createShuriKenParticle3D(props);
				break ;
			case "Camera":
				sprite3d=new EditorCamera();
				sprite3d._parse(props);
				sprite3d.enableRender=false;
				break ;
			case "DirectionLight":
				sprite3d=new DirectionLight();
				sprite3d._parse(props);
				break ;
			case "PointLight":
				sprite3d=new PointLight();
				sprite3d._parse(props);
				break ;
			case "SpotLight":
				sprite3d=new SpotLight();
				sprite3d._parse(props);
				break ;
			case "Rigidbody3D":
				sprite3d=new EditerRigidbody3D();
				sprite3d._parse(props);
				break ;
			case "PhysicsCollider":
				sprite3d=new EditerPhysicsCollider();
				sprite3d._parse(props);
				break ;
			case "BoxColliderShape":
				sprite3d=new EditerBoxColliderShape();
				sprite3d._parse(props);
				break ;
			case "SphereColliderShape":
				sprite3d=new EditerSphereColliderShape();
				sprite3d._parse(props);
				break ;
			case "CapsuleColliderShape":
				sprite3d=new EditerCapsuleColliderShape();
				sprite3d._parse(props);
				break ;
			case "CylinderColliderShape":
				sprite3d=new EditerCylinderColliderShape();
				sprite3d._parse(props);
				break ;
			case "ConeColliderShape":
				sprite3d=new EditerConeColliderShape();
				sprite3d._parse(props);
				break ;
			case "MeshColliderShape":
				sprite3d=new EditerMeshColliderShape();
				sprite3d._parse(props);
				break ;
			case "Sprite3DCase":
				sprite3d=new Sprite3DCase();
				sprite3d._parse(props);
				break ;
			default :;
				var clsname=IDEAPIS.getCompConfigProp(data.type,"className");
				if (clsname){
					var cls=clsname.split('.').reduce(function(obj,i){return obj[i];},window);
					if (cls){
						var sp3d;
						sp3d=new cls(props);
						sprite3d=sp3d;
					}
				}
				if(!sprite3d && clsname){
					(sprite3d=new Sprite3D());
					props && sprite3d._parse(props);
				}
				console.log("Don't Support "+data.type+" Sprite3D !");
			};
		var childData=data.child;
		if (childData){
			for (var i=0,n=childData.length;i < n;i++){
				var child=this.createSpriteByJsonData(childData[i]);
				sprite3d.addChild(child);
			}
		}
		this._owner.sprite3dObjects[data.compId]=sprite3d;
		this._owner.designer.regComp(this._owner.treeData.getNodeByID(data.compId),sprite3d);
		return sprite3d;
	}

	__proto.regNodeDataCreater=function(){
		var i;
		var str;
		var fun=this.createSpriteJsonData.bind(this);;
		for (i in this._plugins){
			str=this._plugins[i];
			IDEAPIS.regNodeDataCreater(str,fun);
		}
	}

	__proto.makeNodeOkForPrefabFile=function(newXml,_xml,isPrefabFile){
		(isPrefabFile===void 0)&& (isPrefabFile=false);
		if(this._owner.designer['isPrefabFile'] || isPrefabFile)
			laya.editor.manager.PreFabManager.I.makeNodeOkForPrefabFile(newXml,_xml);
	}

	__proto.createSpriteJsonData=function(type){
		var props={
			"name":type,
			"active":true,
			"isStatic":false,
			"layer":0,
			"scale":[1,1,1]
		};
		switch(type){
			case "Camera":
				props["clearFlag"]=0;
				props["orthographic"]=false;
				props["fieldOfView"]=60;
				props["nearPlane"]=0.3;
				props["farPlane"]=50;
				props["viewport"]=[0,0,1,1];
				props["clearColor"]=[0.25,0.25,0.25,0];
				break ;
			case "DirectionLight":
				props["intensity"]=1;
				props["lightmapBakedType"]=0;
				props["color"]=[1,1,1];
				break ;
			case "PointLight":
				props["intensity"]=1;
				props["lightmapBakedType"]=0;
				props["range"]=10;
				props["color"]=[1,1,1];
				break ;
			case "SpotLight":
				props["intensity"]=1;
				props["lightmapBakedType"]=0;
				props["range"]=10;
				props["spotAngle"]=30;
				props["color"]=[1,1,1];
				break ;
			default :;
				var tempFile=laya.ide.managers.FileManager.getAppPath('renders/publicres/3DObjTemplate/'+type+'.json');
				var objtemp=laya.ide.managers.FileManager.readJSONFile(tempFile);
				if (objtemp){
					props=objtemp.props;
				}
				break ;
			};
		var p;
		var r;
		if (this._owner){
			if (this._owner.curSelectSprite && this._owner.curSelectSprite.transform){
				p=this._owner.curSelectSprite.transform.position;
				r=this._owner.curSelectSprite.transform.rotation;
				}else{
				p=new Vector3$1();
				r=this._owner.camera.transform.rotation;
				Vector3$1.scale(this._owner.camera.transform.forward,this._owner.worldCentreDistance,p);
				Vector3$1.add(this._owner.camera.transform.position,p,p);
			}
			}else{
			p=new Vector3$1();
			r=new Quaternion$1();
		}
		props["position"]=[p.x,p.y,p.z];
		props["rotation"]=[r.x,r.y,r.z,r.w];
		var data={
			"type":type,
			"child":[],
			"props":props
		}
		return data;
	}

	__proto.setSprite3DProps=function(sprite3d,data){
		sprite3d.active=data.active;
		sprite3d._isStatic=data.isStatic;
		sprite3d.name=data.name;
		if (data.lightmapScaleOffset){
			sprite3d.meshRenderer.lightmapIndex=data.lightmapIndex;
			var v=sprite3d.meshRenderer.lightmapScaleOffset;
			if (!v){
				v=new Vector4$1();
			}
			v.fromArray(data.lightmapScaleOffset);
			sprite3d.meshRenderer.lightmapScaleOffset=v;
		};
		var loccalPosition=sprite3d.transform.localPosition;
		loccalPosition.fromArray(data.position);
		sprite3d.transform.localPosition=loccalPosition;
		if (data.rotationEuler){
			var localRotationEuler=sprite3d.transform.localRotationEuler;
			localRotationEuler.fromArray(data.rotationEuler);
			sprite3d.transform.localRotationEuler=localRotationEuler;
			}else {
			var localRotation=sprite3d.transform.localRotation;
			localRotation.fromArray(data.rotation);
			sprite3d.transform.localRotation=localRotation;
		};
		var localScale=sprite3d.transform.localScale;
		localScale.fromArray(data.scale);
		sprite3d.transform.localScale=localScale;
		var layerData=data.layer;
		(layerData !=null)&& (sprite3d.layer=layerData);
	}

	__proto.createMeshSprite3D=function(data){
		var meshSprite3d=new MeshSprite3D();
		this.setSprite3DProps(meshSprite3d,data);
		var assetsPath=this._owner.assetsPath;
		var lhSubPath=data.lhSubPath;
		if (!lhSubPath)
			lhSubPath='';
		var meshPath=assetsPath+"/"+lhSubPath+data.meshPath;
		if (meshPath){
			Mesh.load(meshPath,Handler.create(null,function(mesh){
				meshSprite3d.meshFilter.sharedMesh=mesh;
			}));
		};
		var materials=data.materials;
		if (materials){
			var sharedMaterials=meshSprite3d.meshRenderer.sharedMaterials;
			var materialCount=materials.length;
			var material;
			sharedMaterials.length=materialCount;
			for (var i=0;i < materialCount;i++){
				material=materials[i];
				sharedMaterials[i]=this.parseMaterial(assetsPath+"/"+lhSubPath+material.path);
			}
			meshSprite3d.meshRenderer.sharedMaterials=sharedMaterials;
		}
		return meshSprite3d;
	}

	__proto.createSkinnedMeshSprite3D=function(data){
		var skinnedMeshSprite3d=new SkinnedMeshSprite3D();
		this.setSprite3DProps(skinnedMeshSprite3d,data);
		var assetsPath=this._owner.assetsPath;
		var lhSubPath=data.lhSubPath;
		if (!lhSubPath)
			lhSubPath='';
		var meshPath=assetsPath+"/"+lhSubPath+data.meshPath;
		if (meshPath){
			Mesh.load(meshPath,Handler.create(null,function(mesh){
				skinnedMeshSprite3d.meshFilter.sharedMesh=mesh;
			}));
		};
		var materials=data.materials;
		if (materials){
			var sharedMaterials=skinnedMeshSprite3d.skinnedMeshRenderer.sharedMaterials;
			var materialCount=materials.length;
			sharedMaterials.length=materialCount;
			var material;
			for (var i=0;i < materialCount;i++){
				material=materials[i];
				lhSubPath=material.lhSubPath;
				if (!lhSubPath)
					lhSubPath='';
				sharedMaterials[i]=this.parseMaterial(assetsPath+"/"+lhSubPath+material.path);
			}
			skinnedMeshSprite3d.skinnedMeshRenderer.sharedMaterials=sharedMaterials;
		}
		return skinnedMeshSprite3d;
	}

	__proto.createShuriKenParticle3D=function(data){
		var anglelToRad=Math.PI / 180.0;
		var shuriKenParticle3d=new ShuriKenParticle3D();
		this.setSprite3DProps(shuriKenParticle3d,data);
		var particleRender=shuriKenParticle3d.particleRenderer;
		var material;
		var assetsPath=this._owner.assetsPath;
		var lhSubPath=data.lhSubPath;
		if (!lhSubPath)
			lhSubPath='';
		if (data.meshPath){
			var meshPath=assetsPath+"/"+lhSubPath+data.meshPath;
			Mesh.load(meshPath,Handler.create(null,function(mesh){
				particleRender.mesh=mesh;
			}));
		}
		if (data.material){
			lhSubPath=data.material.lhSubPath;
			if (!lhSubPath)
				lhSubPath='';
			particleRender.sharedMaterial=this.parseMaterial(assetsPath+"/"+lhSubPath+data.material.path);
		}
		particleRender.renderMode=data.renderMode;
		particleRender.stretchedBillboardCameraSpeedScale=data.stretchedBillboardCameraSpeedScale;
		particleRender.stretchedBillboardSpeedScale=data.stretchedBillboardSpeedScale;
		particleRender.stretchedBillboardLengthScale=data.stretchedBillboardLengthScale;
		particleRender.sortingFudge=data.sortingFudge ? data.sortingFudge :0.0;
		var particleSystem=shuriKenParticle3d.particleSystem;
		particleSystem.isPerformanceMode=data.isPerformanceMode;
		particleSystem.duration=data.duration;
		particleSystem.looping=data.looping;
		particleSystem.prewarm=data.prewarm;
		particleSystem.startDelayType=data.startDelayType;
		particleSystem.startDelay=data.startDelay;
		particleSystem.startDelayMin=data.startDelayMin;
		particleSystem.startDelayMax=data.startDelayMax;
		particleSystem.startLifetimeType=data.startLifetimeType;
		particleSystem.startLifetimeConstant=data.startLifetimeConstant;
		particleSystem.startLifeTimeGradient=Editer3DUtils._initStartLife(data.startLifetimeGradient);
		particleSystem.startLifetimeConstantMin=data.startLifetimeConstantMin;
		particleSystem.startLifetimeConstantMax=data.startLifetimeConstantMax;
		particleSystem.startLifeTimeGradientMin=Editer3DUtils._initStartLife(data.startLifetimeGradientMin);
		particleSystem.startLifeTimeGradientMax=Editer3DUtils._initStartLife(data.startLifetimeGradientMax);
		particleSystem.startSpeedType=data.startSpeedType;
		particleSystem.startSpeedConstant=data.startSpeedConstant;
		particleSystem.startSpeedConstantMin=data.startSpeedConstantMin;
		particleSystem.startSpeedConstantMax=data.startSpeedConstantMax;
		particleSystem.threeDStartSize=data.threeDStartSize;
		particleSystem.startSizeType=data.startSizeType;
		particleSystem.startSizeConstant=data.startSizeConstant;
		var startSizeConstantSeparateArray=data.startSizeConstantSeparate;
		var startSizeConstantSeparateElement=particleSystem.startSizeConstantSeparate.elements;
		startSizeConstantSeparateElement[0]=startSizeConstantSeparateArray[0];
		startSizeConstantSeparateElement[1]=startSizeConstantSeparateArray[1];
		startSizeConstantSeparateElement[2]=startSizeConstantSeparateArray[2];
		particleSystem.startSizeConstantMin=data.startSizeConstantMin;
		particleSystem.startSizeConstantMax=data.startSizeConstantMax;
		var startSizeConstantMinSeparateArray=data.startSizeConstantMinSeparate;
		var startSizeConstantMinSeparateElement=particleSystem.startSizeConstantMinSeparate.elements;
		startSizeConstantMinSeparateElement[0]=startSizeConstantMinSeparateArray[0];
		startSizeConstantMinSeparateElement[1]=startSizeConstantMinSeparateArray[1];
		startSizeConstantMinSeparateElement[2]=startSizeConstantMinSeparateArray[2];
		var startSizeConstantMaxSeparateArray=data.startSizeConstantMaxSeparate;
		var startSizeConstantMaxSeparateElement=particleSystem.startSizeConstantMaxSeparate.elements;
		startSizeConstantMaxSeparateElement[0]=startSizeConstantMaxSeparateArray[0];
		startSizeConstantMaxSeparateElement[1]=startSizeConstantMaxSeparateArray[1];
		startSizeConstantMaxSeparateElement[2]=startSizeConstantMaxSeparateArray[2];
		particleSystem.threeDStartRotation=data.threeDStartRotation;
		particleSystem.startRotationType=data.startRotationType;
		particleSystem.startRotationConstant=data.startRotationConstant *anglelToRad;
		var startRotationConstantSeparateArray=data.startRotationConstantSeparate;
		var startRotationConstantSeparateElement=particleSystem.startRotationConstantSeparate.elements;
		startRotationConstantSeparateElement[0]=startRotationConstantSeparateArray[0] *anglelToRad;
		startRotationConstantSeparateElement[1]=startRotationConstantSeparateArray[1] *anglelToRad;
		startRotationConstantSeparateElement[2]=startRotationConstantSeparateArray[2] *anglelToRad;
		particleSystem.startRotationConstantMin=data.startRotationConstantMin *anglelToRad;
		particleSystem.startRotationConstantMax=data.startRotationConstantMax *anglelToRad;
		var startRotationConstantMinSeparateArray=data.startRotationConstantMinSeparate;
		var startRotationConstantMinSeparateElement=particleSystem.startRotationConstantMinSeparate.elements;
		startRotationConstantMinSeparateElement[0]=startRotationConstantMinSeparateArray[0] *anglelToRad;
		startRotationConstantMinSeparateElement[1]=startRotationConstantMinSeparateArray[1] *anglelToRad;
		startRotationConstantMinSeparateElement[2]=startRotationConstantMinSeparateArray[2] *anglelToRad;
		var startRotationConstantMaxSeparateArray=data.startRotationConstantMaxSeparate;
		var startRotationConstantMaxSeparateElement=particleSystem.startRotationConstantMaxSeparate.elements;
		startRotationConstantMaxSeparateElement[0]=startRotationConstantMaxSeparateArray[0] *anglelToRad;
		startRotationConstantMaxSeparateElement[1]=startRotationConstantMaxSeparateArray[1] *anglelToRad;
		startRotationConstantMaxSeparateElement[2]=startRotationConstantMaxSeparateArray[2] *anglelToRad;
		particleSystem.randomizeRotationDirection=data.randomizeRotationDirection;
		particleSystem.startColorType=data.startColorType;
		var startColorConstantArray=data.startColorConstant;
		var startColorConstantElement=particleSystem.startColorConstant.elements;
		startColorConstantElement[0]=startColorConstantArray[0];
		startColorConstantElement[1]=startColorConstantArray[1];
		startColorConstantElement[2]=startColorConstantArray[2];
		startColorConstantElement[3]=startColorConstantArray[3];
		var startColorConstantMinArray=data.startColorConstantMin;
		var startColorConstantMinElement=particleSystem.startColorConstantMin.elements;
		startColorConstantMinElement[0]=startColorConstantMinArray[0];
		startColorConstantMinElement[1]=startColorConstantMinArray[1];
		startColorConstantMinElement[2]=startColorConstantMinArray[2];
		startColorConstantMinElement[3]=startColorConstantMinArray[3];
		var startColorConstantMaxArray=data.startColorConstantMax;
		var startColorConstantMaxElement=particleSystem.startColorConstantMax.elements;
		startColorConstantMaxElement[0]=startColorConstantMaxArray[0];
		startColorConstantMaxElement[1]=startColorConstantMaxArray[1];
		startColorConstantMaxElement[2]=startColorConstantMaxArray[2];
		startColorConstantMaxElement[3]=startColorConstantMaxArray[3];
		particleSystem.gravityModifier=data.gravityModifier;
		particleSystem.simulationSpace=data.simulationSpace;
		particleSystem.scaleMode=data.scaleMode;
		particleSystem.playOnAwake=data.playOnAwake;
		particleSystem.maxParticles=data.maxParticles;
		var autoRandomSeed=data.autoRandomSeed;
		(autoRandomSeed !=null)&& (particleSystem.autoRandomSeed=autoRandomSeed);
		var randomSeed=data.randomSeed;
		(randomSeed !=null)&& (particleSystem.randomSeed[0]=randomSeed);
		var i=0;
		var n=0;
		var emissionData=data.emission;
		var emission=particleSystem.emission;
		if (emissionData){
			emission.emissionRate=emissionData.emissionRate;
			var burstsData=emissionData.bursts;
			if (burstsData)
				var brust;
			for (i=0,n=burstsData.length;i < n;i++){
				brust=burstsData[i];
				emission.addBurst(new Burst(brust.time,brust.min,brust.max));
			}
			emission.enbale=emissionData.enable;
			}else {
			emission.enbale=false;
		};
		var shapeData=data.shape;
		if (shapeData){
			var shape;
			switch (shapeData.shapeType){
				case 0:;
					var sphereShape;
					shape=sphereShape=new SphereShape();
					sphereShape.radius=shapeData.sphereRadius;
					sphereShape.emitFromShell=shapeData.sphereEmitFromShell;
					sphereShape.randomDirection=shapeData.sphereRandomDirection;
					break ;
				case 1:;
					var hemiSphereShape;
					shape=hemiSphereShape=new HemisphereShape();
					hemiSphereShape.radius=shapeData.hemiSphereRadius;
					hemiSphereShape.emitFromShell=shapeData.hemiSphereEmitFromShell;
					hemiSphereShape.randomDirection=shapeData.hemiSphereRandomDirection;
					break ;
				case 2:;
					var coneShape;
					shape=coneShape=new ConeShape();
					coneShape.angle=shapeData.coneAngle *anglelToRad;
					coneShape.radius=shapeData.coneRadius;
					coneShape.length=shapeData.coneLength;
					coneShape.emitType=shapeData.coneEmitType;
					coneShape.randomDirection=shapeData.coneRandomDirection;
					break ;
				case 3:;
					var boxShape;
					shape=boxShape=new BoxShape();
					boxShape.x=shapeData.boxX;
					boxShape.y=shapeData.boxY;
					boxShape.z=shapeData.boxZ;
					boxShape.randomDirection=shapeData.boxRandomDirection;
					break ;
				case 7:;
					var circleShape;
					shape=circleShape=new CircleShape();
					circleShape.radius=shapeData.circleRadius;
					circleShape.arc=shapeData.circleArc *anglelToRad;
					circleShape.emitFromEdge=shapeData.circleEmitFromEdge;
					circleShape.randomDirection=shapeData.circleRandomDirection;
					break ;
				default :;
					var tempShape;
					shape=tempShape=new CircleShape();
					tempShape.radius=shapeData.circleRadius;
					tempShape.arc=shapeData.circleArc *anglelToRad;
					tempShape.emitFromEdge=shapeData.circleEmitFromEdge;
					tempShape.randomDirection=shapeData.circleRandomDirection;
					break ;
				}
			shape.enable=shapeData.enable;
			particleSystem.shape=shape;
		};
		var velocityOverLifetimeData=data.velocityOverLifetime;
		if (velocityOverLifetimeData){
			var velocityData=velocityOverLifetimeData.velocity;
			var velocity;
			switch (velocityData.type){
				case 0:;
					var constantData=velocityData.constant;
					velocity=GradientVelocity.createByConstant(new Vector3$1(constantData[0],constantData[1],constantData[2]));
					break ;
				case 1:
					velocity=GradientVelocity.createByGradient(this._initParticleVelocity(velocityData.gradientX),this._initParticleVelocity(velocityData.gradientY),this._initParticleVelocity(velocityData.gradientZ));
					break ;
				case 2:;
					var constantMinData=velocityData.constantMin;
					var constantMaxData=velocityData.constantMax;
					velocity=GradientVelocity.createByRandomTwoConstant(new Vector3$1(constantMinData[0],constantMinData[1],constantMinData[2]),new Vector3$1(constantMaxData[0],constantMaxData[1],constantMaxData[2]));
					break ;
				case 3:
					velocity=GradientVelocity.createByRandomTwoGradient(this._initParticleVelocity(velocityData.gradientXMin),this._initParticleVelocity(velocityData.gradientXMax),this._initParticleVelocity(velocityData.gradientYMin),this._initParticleVelocity(velocityData.gradientYMax),this._initParticleVelocity(velocityData.gradientZMin),this._initParticleVelocity(velocityData.gradientZMax));
					break ;
				};
			var velocityOverLifetime=new VelocityOverLifetime(velocity);
			velocityOverLifetime.space=velocityOverLifetimeData.space;
			velocityOverLifetime.enbale=velocityOverLifetimeData.enable;
			particleSystem.velocityOverLifetime=velocityOverLifetime;
		};
		var colorOverLifetimeData=data.colorOverLifetime;
		if (colorOverLifetimeData){
			var colorData=colorOverLifetimeData.color;
			var color;
			switch (colorData.type){
				case 0:;
					var constColorData=colorData.constant;
					color=GradientColor.createByConstant(new Vector4$1(constColorData[0],constColorData[1],constColorData[2],constColorData[3]));
					break ;
				case 1:
					color=GradientColor.createByGradient(this._initParticleColor(colorData.gradient));
					break ;
				case 2:;
					var minConstColorData=colorData.constantMin;
					var maxConstColorData=colorData.constantMax;
					color=GradientColor.createByRandomTwoConstant(new Vector4$1(minConstColorData[0],minConstColorData[1],minConstColorData[2],minConstColorData[3]),new Vector4$1(maxConstColorData[0],maxConstColorData[1],maxConstColorData[2],maxConstColorData[3]));
					break ;
				case 3:
					color=GradientColor.createByRandomTwoGradient(this._initParticleColor(colorData.gradientMin),this._initParticleColor(colorData.gradientMax));
					break ;
				};
			var colorOverLifetime=new ColorOverLifetime(color);
			colorOverLifetime.enbale=colorOverLifetimeData.enable;
			particleSystem.colorOverLifetime=colorOverLifetime;
		};
		var sizeOverLifetimeData=data.sizeOverLifetime;
		if (sizeOverLifetimeData){
			var sizeData=sizeOverLifetimeData.size;
			var size;
			switch (sizeData.type){
				case 0:
					if (sizeData.separateAxes){
						size=GradientSize.createByGradientSeparate(this._initParticleSize(sizeData.gradientX),this._initParticleSize(sizeData.gradientY),this._initParticleSize(sizeData.gradientZ));
						}else {
						size=GradientSize.createByGradient(this._initParticleSize(sizeData.gradient));
					}
					break ;
				case 1:
					if (sizeData.separateAxes){
						var constantMinSeparateData=sizeData.constantMinSeparate;
						var constantMaxSeparateData=sizeData.constantMaxSeparate;
						size=GradientSize.createByRandomTwoConstantSeparate(new Vector3$1(constantMinSeparateData[0],constantMinSeparateData[1],constantMinSeparateData[2]),new Vector3$1(constantMaxSeparateData[0],constantMaxSeparateData[1],constantMaxSeparateData[2]));
						}else {
						size=GradientSize.createByRandomTwoConstant(sizeData.constantMin,sizeData.constantMax);
					}
					break ;
				case 2:
					if (sizeData.separateAxes){
						size=GradientSize.createByRandomTwoGradientSeparate(this._initParticleSize(sizeData.gradientXMin),this._initParticleSize(sizeData.gradientYMin),this._initParticleSize(sizeData.gradientZMin),this._initParticleSize(sizeData.gradientXMax),this._initParticleSize(sizeData.gradientYMax),this._initParticleSize(sizeData.gradientZMax));
						}else {
						size=GradientSize.createByRandomTwoGradient(this._initParticleSize(sizeData.gradientMin),this._initParticleSize(sizeData.gradientMax));
					}
					break ;
				};
			var sizeOverLifetime=new SizeOverLifetime(size);
			sizeOverLifetime.enbale=sizeOverLifetimeData.enable;
			particleSystem.sizeOverLifetime=sizeOverLifetime;
		};
		var rotationOverLifetimeData=data.rotationOverLifetime;
		if (rotationOverLifetimeData){
			var angularVelocityData=rotationOverLifetimeData.angularVelocity;
			var angularVelocity;
			switch (angularVelocityData.type){
				case 0:
					if (angularVelocityData.separateAxes){
						}else {
						angularVelocity=GradientAngularVelocity.createByConstant(angularVelocityData.constant *anglelToRad);
					}
					break ;
				case 1:
					if (angularVelocityData.separateAxes){
						}else {
						angularVelocity=GradientAngularVelocity.createByGradient(this._initParticleRotation(angularVelocityData.gradient));
					}
					break ;
				case 2:
					if (angularVelocityData.separateAxes){
						var minSep=angularVelocityData.constantMinSeparate;
						var maxSep=angularVelocityData.constantMaxSeparate;
						angularVelocity=GradientAngularVelocity.createByRandomTwoConstantSeparate(new Vector3$1(minSep[0] *anglelToRad,minSep[1] *anglelToRad,minSep[2] *anglelToRad),new Vector3$1(maxSep[0] *anglelToRad,maxSep[1] *anglelToRad,maxSep[2] *anglelToRad));
						}else {
						angularVelocity=GradientAngularVelocity.createByRandomTwoConstant(angularVelocityData.constantMin *anglelToRad,angularVelocityData.constantMax *anglelToRad);
					}
					break ;
				case 3:
					if (angularVelocityData.separateAxes){
						}else {
						angularVelocity=GradientAngularVelocity.createByRandomTwoGradient(this._initParticleRotation(angularVelocityData.gradientMin),this._initParticleRotation(angularVelocityData.gradientMax));
					}
					break ;
				};
			var rotationOverLifetime=new RotationOverLifetime(angularVelocity);
			rotationOverLifetime.enbale=rotationOverLifetimeData.enable;
			particleSystem.rotationOverLifetime=rotationOverLifetime;
		};
		var textureSheetAnimationData=data.textureSheetAnimation;
		if (textureSheetAnimationData){
			var frameData=textureSheetAnimationData.frame;
			var frameOverTime;
			switch (frameData.type){
				case 0:
					frameOverTime=FrameOverTime.createByConstant(frameData.constant);
					break ;
				case 1:
					frameOverTime=FrameOverTime.createByOverTime(this._initParticleFrame(frameData.overTime));
					break ;
				case 2:
					frameOverTime=FrameOverTime.createByRandomTwoConstant(frameData.constantMin,frameData.constantMax);
					break ;
				case 3:
					frameOverTime=FrameOverTime.createByRandomTwoOverTime(this._initParticleFrame(frameData.overTimeMin),this._initParticleFrame(frameData.overTimeMax));
					break ;
				};
			var startFrameData=textureSheetAnimationData.startFrame;
			var startFrame;
			switch (startFrameData.type){
				case 0:
					startFrame=StartFrame.createByConstant(startFrameData.constant);
					break ;
				case 1:
					startFrame=StartFrame.createByRandomTwoConstant(startFrameData.constantMin,startFrameData.constantMax);
					break ;
				};
			var textureSheetAnimation=new TextureSheetAnimation(frameOverTime,startFrame);
			textureSheetAnimation.enable=textureSheetAnimationData.enable;
			var tilesData=textureSheetAnimationData.tiles;
			textureSheetAnimation.tiles=new Vector2$1(tilesData[0],tilesData[1]);
			textureSheetAnimation.type=textureSheetAnimationData.type;
			textureSheetAnimation.randomRow=textureSheetAnimationData.randomRow;
			var rowIndex=textureSheetAnimationData.rowIndex;
			(rowIndex!==undefined)&& (textureSheetAnimation.rowIndex=rowIndex);
			textureSheetAnimation.cycles=textureSheetAnimationData.cycles;
			particleSystem.textureSheetAnimation=textureSheetAnimation;
		}
		return shuriKenParticle3d;
	}

	__proto._initParticleVelocity=function(gradientData){
		var valueData;
		var gradient=new GradientDataNumber();
		var velocitysData=gradientData.velocitys;
		for (var i=0,n=velocitysData.length;i < n;i++){
			valueData=velocitysData[i];
			gradient.add(valueData.key,valueData.value);
		}
		return gradient;
	}

	__proto._initParticleColor=function(gradientColorData){
		var alphaData;
		var gradientColor=new Gradient(4,4);
		var alphasData=gradientColorData.alphas;
		var i=0,n=0;
		for (i=0,n=alphasData.length;i < n;i++){
			alphaData=alphasData[i];
			if ((i===3)&& ((alphaData.key!==1))){
				alphaData.key=1;
				console.log("GradientDataColor warning:the forth key is  be force set to 1.");
			}
			gradientColor.addColorAlpha(alphaData.key,alphaData.value);
		};
		var rgbsData=gradientColorData.rgbs;
		var rgbValue;
		var rgbData;
		for (i=0,n=rgbsData.length;i < n;i++){
			rgbData=rgbsData[i];
			rgbValue=rgbData.value;
			if ((i===3)&& ((rgbData.key!==1))){
				rgbData.key=1;
				console.log("GradientDataColor warning:the forth key is  be force set to 1.");
			}
			gradientColor.addColorRGB(rgbData.key,new Color(rgbValue[0],rgbValue[1],rgbValue[2],1.0));
		}
		return gradientColor;
	}

	__proto._initParticleSize=function(gradientSizeData){
		var valueData;
		var gradientSize=new GradientDataNumber();
		var sizesData=gradientSizeData.sizes;
		for (var i=0,n=sizesData.length;i < n;i++){
			valueData=sizesData[i];
			gradientSize.add(valueData.key,valueData.value);
		}
		return gradientSize;
	}

	__proto._initParticleRotation=function(gradientData){
		var valueData;
		var gradient=new GradientDataNumber();
		var angularVelocitysData=gradientData.angularVelocitys;
		for (var i=0,n=angularVelocitysData.length;i < n;i++){
			valueData=angularVelocitysData[i];
			gradient.add(valueData.key,valueData.value / 180.0 *Math.PI);
		}
		return gradient;
	}

	__proto._initParticleFrame=function(overTimeFramesData){
		var frameData;
		var overTimeFrame=new GradientDataInt();
		var framesData=overTimeFramesData.frames;
		for (var i=0,n=framesData.length;i < n;i++){
			frameData=framesData[i];
			overTimeFrame.add(frameData.key,frameData.value);
		}
		return overTimeFrame;
	}

	__proto.parseMaterial=function(lmatPath){
		var data=laya.ide.managers.FileManager.readJSONFile(lmatPath);
		var props=data.props;
		var material;
		var classType=props.type;
		if (classType){
			var clasPaths=classType.split('.');
			var clas=Browser.window;
			clasPaths.forEach(function(cls){
				clas=clas[cls];
			});
			material=new clas();
		}
		else{
			material=new BlinnPhongMaterial();
		};
		var i=0,n=0;
		for (var key in props){
			switch (key){
				case "vectors":;
					var vectors=props[key];
					var vector;
					var vectorValue;
					for (i=0,n=vectors.length;i < n;i++){
						vector=vectors[i];
						vectorValue=vector.value;
					switch (vectorValue.length){
						case 2:
							material[vector.name]=new Vector2$1(vectorValue[0],vectorValue[1]);
							break ;
						case 3:
							material[vector.name]=new Vector3$1(vectorValue[0],vectorValue[1],vectorValue[2]);
							break ;
						case 4:
							material[vector.name]=new Vector4$1(vectorValue[0],vectorValue[1],vectorValue[2],vectorValue[3]);
							break ;
						default :
							throw new Error("BaseMaterial:unkonwn color length.");
						}
				}
				break ;
				case "textures":;
				var reFlash=false;
				var textures=props[key];
				var texture;
				var texturePath;
				var lhSubPath;
				for (i=0,n=textures.length;i < n;i++){
					texture=textures[i];
					lhSubPath=texture.lhSubPath;
					if (!lhSubPath)
						lhSubPath='';
					texturePath=this._owner.assetsPath+"/"+lhSubPath+texture.path;
					if (!laya.ide.managers.FileManager.exists(texturePath)){
						var dirPath=lmatPath.substring(0,lmatPath.lastIndexOf('/'));
						texturePath=laya.ide.managers.FileManager.getPath(dirPath,texture.path);
						texture.path=laya.ide.managers.FileManager.getRelativePath(this._owner.assetsPath,texturePath);
					}
					Laya.loader.create(texturePath,Handler.create(this,function(name,tex2d){
						material[name]=tex2d;
					},[texture.name]));
				}
				break ;
				case "defines":;
				var defineNames=props[key];
				var define=0;
				for (i=0,n=defineNames.length;i < n;i++){
					define=material._shader.getMaterialDefineByName(defineNames[i]);
					material._defineDatas.add(define);
				}
				break ;
				case "cull":
				case "blend":
				case "srcBlend":
				case "dstBlend":
				case "depthWrite":;
				var value=props[key];
				for (i=0,n=material._renderStates.length;i < n;i++)
				material._renderStates[i][key]=value;
				break ;
				case "renderQueue":;
				var queue=props[key];
				switch (queue){
					case 1:
						material.renderQueue=2000;
						break ;
					case 2:
						material.renderQueue=3000;
						break ;
					default :
						material[key]=props[key];
					}
				break ;
				default :
				material[key]=props[key];
			}
		}
		return material;
	}

	__proto.saveLayaLmatFile=function(mat){
		var assetsPath=this._owner.assetsPath;
		var albedoColor=mat.albedoColor;
		var relativeAlbedoTextureURL=mat.albedoTexture ? laya.ide.managers.FileManager.getRelativePath(assetsPath,mat.albedoTexture.url):"null";
		var matFileName=relativeAlbedoTextureURL.replace(/\\/g,"-").replace(/\//g,"-").replace(":","-")+"&"+albedoColor.x.toFixed(2)+"-"+albedoColor.y.toFixed(2)+"-"+albedoColor.z.toFixed(2)+"-"+albedoColor.w.toFixed(2)+".lmat";
		var lmatPath="Materials/"+matFileName;
		var savePath=assetsPath+"/"+lmatPath;
		if (laya.ide.managers.FileManager.exists(savePath)){
			return lmatPath;
		};
		var lmatData={};
		var propsObj={};
		var texturesArr=[];
		var vectorsArr=[];
		lmatData.version="LAYAMATERIAL:02";
		lmatData.props=propsObj;
		propsObj.type="Laya.BlinnPhongMaterial";
		propsObj.textures=texturesArr;
		propsObj.vectors=vectorsArr;
		if (relativeAlbedoTextureURL !="null"){
			var textureObj={};
			textureObj.name="albedoTexture";
			textureObj.path=relativeAlbedoTextureURL;
			texturesArr.push(textureObj);
		};
		var albedoColorObj={};
		albedoColorObj.name="albedoColor";
		albedoColorObj.value=[albedoColor.x,albedoColor.y,albedoColor.z,albedoColor.w];
		vectorsArr.push(albedoColorObj);
		laya.ide.managers.FileManager.createJSONFile(savePath,lmatData);
		return lmatPath;
	}

	__proto.updatePrefaFile=function(data,lhSubPath,_parentPath,_prefab){
		var props=data.props;
		var components=data.components;
		var i=0,l=0;
		var obj;
		var parentPath=(_parentPath=='')?props.name:_parentPath+'.'+props.name;
		(data.type=="Camera")&& (props.active=false);
		if (props){
			data.props['parentPath']=parentPath;
			data.props['prefabPath']=_prefab;
			if(_prefab.indexOf(lhSubPath)==-1)
				data.props['lhSubPath']=lhSubPath;
			var materials=props.materials;
			if (materials){
				data.props.materials=materials;
			}
		}
		if (components && components.length){
			for (i=0,l=components.length;i < l;i++){
				obj=components[i];
				components[i]=obj;
			}
		};
		var childData=data.child;
		if (childData){
			for (i=0,l=childData.length;i < l;i++){
				this.updatePrefaFile(childData[i],lhSubPath,parentPath,_prefab);
			}
		}
	}

	__proto.updateLayaScene3dFile=function(data,lhSubPath){
		var props=data.props;
		var components=data.components;
		if (props.rotation){
			this._quaternion.fromArray(props.rotation);
			this._quaternion.getYawPitchRoll(this._rotationEuler);
			var rotationEuler=[];
			rotationEuler[0]=this._rotationEuler.y *this._angleToRandin;
			rotationEuler[1]=this._rotationEuler.x *this._angleToRandin;
			rotationEuler[2]=this._rotationEuler.z *this._angleToRandin;
			props.rotationEuler=rotationEuler;
		}
		if (props.meshPath){
			props.meshPath=lhSubPath+props.meshPath;
		}
		if (props.materials){
			for (var j=0,m=props.materials.length;j < m;j++){
				if (props.materials[j]){
					props.materials[j].path=lhSubPath+props.materials[j].path;
				}
			}
		}
		if (props.material){
			props.material.path=lhSubPath+props.material.path;
		}
		if (components){
			var component;
			var layers;
			for (var k=0;k < components.length;k++){
				component=components[k];
				if (component.type=="Animator"){
					if (component.avatar && component.avatar.path){
						component.avatar.path=lhSubPath+component.avatar.path;
					}
					layers=component.layers;
					if (layers){
						var layer;
						var states;
						for (var l=0;l < layers.length;l++){
							layer=layers[l];
							states=layer.states;
							if (states){
								var state;
								for (var o=0;o < states.length;o++){
									state=states[o];
									if (state.clipPath){
										state.clipPath=lhSubPath+state.clipPath;
									}
								}
							}
						}
					}
				}
				else{
					components.splice(k--,1);
				}
			}
		};
		var childData=data.child;
		if (childData){
			for (var i=0,n=childData.length;i < n;i++){
				this.updateLayaScene3dFile(childData[i],lhSubPath);
			}
		}
	}

	__getset(1,Editer3DUtils,'I',function(){
		return Editer3DUtils._i || (Editer3DUtils._i=new Editer3DUtils());
	});

	Editer3DUtils._initStartLife=function(gradientData){
		var valueData;
		var gradient=new GradientDataNumber();
		var startLifetimesData=gradientData.startLifetimes;
		for (var i=0,n=startLifetimesData.length;i < n;i++){
			valueData=startLifetimesData[i];
			gradient.add(valueData.key,valueData.value);
		}
		return gradient
	}

	Editer3DUtils._i=null;
	return Editer3DUtils;
})()


/**
*Prefab数据控制工具
*@author ww
*@version 1.0
*
*@created 2018-7-13 上午10:49:06
*/
//class laya.ide.designplugin.manager.PrefabData
var PrefabData=(function(){
	function PrefabData(){
		this.prefabDataO=null;
		this.sign=null;
		this.prefabRootID=0;
		this.presetIDDic=null;
		this._reserveKeys={'parentPath':true,'prefabPath':true,'lhSubPath':true,'preset':true,'presetID':true};
		this._lsSubPath="";
		this.compId=0;
		this.isPrefabFile=false;
	}

	__class(PrefabData,'laya.ide.designplugin.manager.PrefabData');
	var __proto=PrefabData.prototype;
	__proto.initByPrefabPath=function(prefabPath){
		this.sign=prefabPath;
		this.prefabDataO=laya.ide.managers.FileManager.readJSONFile(IDEAPIS.assetsPath+'/'+prefabPath).data;
		var paths=prefabPath.split('/');
		for (var i=0;i < paths.length-1;i++){
			this._lsSubPath+=paths[i]+"/";
		}
		if(!this.prefabDataO)return;
		if(!this.prefabDataO.type)this.prefabDataO=null;
		this.prefabRootID=this.prefabDataO.props["name"];
		this.presetIDDic=PrefabManager.I.createFileCache(this.sign,false);
	}

	__proto.isPresetRoot=function(nodeO){
		if(!nodeO||!nodeO.props||nodeO.props.prefabPath!=this.sign)return false;
		return nodeO.props.parentPath==this.prefabRootID;
	}

	__proto.updatePrefabedNode=function(nodeO,isPre){
		var _$this=this;
		(isPre===void 0)&& (isPre=false);
		var nodeIDDic;
		var nodePresetIDDic;
		var nodeParentDic;
		var nodePresetIDSign;
		var curPresetSign;
		nodePresetIDSign="parentPath";
		function isOkNode (node){
			if(!node||!node.props)return false;
			return node.props["prefabPath"]==_$this.sign;
		}
		nodePresetIDDic=laya.editor.core.design.TreeDataTool.buildNode(nodeO,null,nodePresetIDSign,true,isOkNode);
		nodeIDDic=laya.editor.core.design.TreeDataTool.buildNode(nodeO,null,"compId",false);
		nodeParentDic=laya.editor.core.design.TreeDataTool['buildParentDic'](nodeO,null,"compId",false,null);
		var curPresetID;
		var tNodeO;
		var tParentO;
		var tParentPresetID;
		var flag=false;
		flag=false;
		for(curPresetID in this.presetIDDic){
			if(!nodePresetIDDic[curPresetID]){
				tNodeO=this.presetIDDic[curPresetID];
				var paths=curPresetID.split('.');
				var parentP=paths[0];
				for (var i=1;i < paths.length-1;i++){
					parentP+="."+paths[i];
				}
				tParentO=nodePresetIDDic[parentP];
				if(tNodeO){
					tNodeO=ObjectTools.copyObjFast(tNodeO);
					var props=tNodeO.props;
					props.parentPath=curPresetID;
					props.prefabPath=this.sign;
					props.lhSubPath=this._lsSubPath;
					if (this.isPrefabFile){
						var compId=0;
						for (var key in nodeIDDic){
							compId=Math.max(compId,key);
						}
						tNodeO.compId=++compId;
					}
					laya.editor.manager.PreFabManager.I.makeNodeOkForPrefabFile(tNodeO,nodeO);
					this.isPrefabFile=false;
					laya.editor.core.design.TreeDataTool.deleteAllKeyBut(tNodeO,this._reserveKeys);
					tParentO.child.push(tNodeO);
					flag=true;
				}
			}
		}
		for(curPresetID in nodePresetIDDic){
			if(!this.presetIDDic[curPresetID]){
				tNodeO=nodePresetIDDic[curPresetID];
				tParentO=nodeParentDic[tNodeO["compId"]];
				laya.editor.core.design.TreeData.removeNodeFromNodeTree(tParentO,tNodeO["compId"]);
				flag=true;
			}
		}
		return flag;
	}

	__proto.updatePrefabedNode2=function(nodeO,isPre){
		(isPre===void 0)&& (isPre=false);
		var flag=false;
		var workPath=laya.ide.managers.FileManager.getWorkPath(nodeO.props.preset);
		var prefabData=laya.ide.managers.FileManager.readJSONFile(workPath);
		this.isPrefabFile=true;
		flag=this.updatePrefabedNode(prefabData,isPre);
		if (flag){
			Laya.timer.frameOnce(1,this,function(){
				IDEAPIS['savePage'](workPath,prefabData);
				PrefabManager.I.prefabFileChange(workPath);
			});
		}
		return flag;
	}

	__proto.updateNode2=function(nodeO){
		var flag=false;
		flag=false;
		if(nodeO.props.preset){
			return this.updatePrefabedNode2(nodeO,true);
		};
		var childs;
		childs=nodeO.child;
		if(!childs)return flag;
		var i=0,len=0;
		len=childs.length;
		for(i=0;i<len;i++){
			if(this.updateNode(childs[i])){
				flag=true;
			}
		}
		return flag;
	}

	__proto.updateNode=function(nodeO){
		var flag=false;
		flag=false;
		if(this.isPresetRoot(nodeO)){
			return this.updatePrefabedNode(nodeO);
		};
		var childs;
		childs=nodeO.child;
		if(!childs)return flag;
		var i=0,len=0;
		len=childs.length;
		for(i=0;i<len;i++){
			if(this.updateNode(childs[i])){
				flag=true;
			}
		}
		return flag;
	}

	return PrefabData;
})()


/**
*...
*@author zyh
*/
//class laya.ide.designplugin.manager.PrefabManager
var PrefabManager=(function(){
	function PrefabManager(){
		this.isFresh=false;
	}

	__class(PrefabManager,'laya.ide.designplugin.manager.PrefabManager');
	var __proto=PrefabManager.prototype;
	__proto.getPreFabByNode=function(data,_props,isPrefabFile){
		(isPrefabFile===void 0)&& (isPrefabFile=false);
		var props=_props?_props:data.props;
		var prefabPath=props.prefabPath;
		var parentPath=props.parentPath;
		var filePath=IDEAPIS.assetsPath+'/'+prefabPath;
		var filecache=PrefabManager.fileCaches[prefabPath];
		var prefabData;
		if (!filecache){
			prefabData=new PrefabData();
			filecache=this.createFileCache(prefabPath);
			PrefabManager.fileCaches[prefabPath]=filecache;
			}else{
			var oldTimer=filecache.fileTime;
			var timer=laya.ide.devices.FileTools.getMtimeStr(filePath);;
			if (oldTimer !=timer){
				filecache=this.createFileCache(prefabPath);
				prefabData=new PrefabData();
				PrefabManager.fileCaches[prefabPath]=filecache;
			}
		}
		if (prefabData){
			prefabData.initByPrefabPath(prefabPath);
			if (props.preset && !isPrefabFile){
				if (prefabData.updateNode2(data)){
					PrefabManager.fileCaches[prefabPath]=null;
					return null
				}
			}
			else
			this.isFresh=prefabData.updateNode(data);
		};
		var cacheData=filecache[parentPath];
		return cacheData;
	}

	__proto.createFileCache=function(path,addTimeStr){
		(addTimeStr===void 0)&& (addTimeStr=true);
		var obj={};
		var filePath=IDEAPIS.assetsPath+'/'+path;
		var fileData=laya.ide.managers.FileManager.readJSONFile(filePath).data;
		var parentPath=fileData.props.name;
		obj[parentPath]=fileData;
		this.getChildData(fileData,parentPath,obj);
		if(addTimeStr)
			obj.fileTime=laya.ide.devices.FileTools.getMtimeStr(filePath);;
		return obj;
	}

	/**
	*通知ide预设文件变化
	*@param _pagePath 预设文件路径
	*/
	__proto.prefabFileChange=function(_pagePath){
		laya.editor.manager.PreFabManager.I.prefabFileChange(_pagePath);
	}

	__proto.getChildData=function(data,parentPath,out){
		var child=data.child;
		var path;
		for (var i=0;i < child.length;i++){
			path=parentPath+'.'+child[i].props.name;
			out[path]=child[i];
			this.getChildData(child[i],path,out);
		}
	}

	__getset(1,PrefabManager,'I',function(){
		return PrefabManager._i=PrefabManager._i|| new PrefabManager();
	});

	PrefabManager.fileCaches={};
	PrefabManager._i=null;
	return PrefabManager;
})()


/**
*...
*@author zyh
*/
//class laya.ide.designplugin.menu.MenuEnum
var MenuEnum=(function(){
	function MenuEnum(){}
	__class(MenuEnum,'laya.ide.designplugin.menu.MenuEnum');
	MenuEnum.EDIT_PATTERN_MOVE_STAGE=0;
	MenuEnum.EDIT_PATTERN_MOVE_OBJECT=1;
	MenuEnum.EDIT_PATTERN_ROTATE_OBJECT=2;
	MenuEnum.EDIT_PATTERN_SCALE_OBJECT=3;
	return MenuEnum;
})()


/**
*...
*/
//class laya.ide.designplugin.Sprite3DCase extends laya.d3.core.Sprite3D
var Sprite3DCase=(function(_super){
	function Sprite3DCase(name){
		this.pivotX=NaN;
		this.pivotY=NaN;
		this._animator=null;
		this._preSp=null;
		this._preHandle=null;
		this.kk=null;
		Sprite3DCase.__super.call(this,name);
		this.pivotX=0;
		this.pivotY=0;
		this.active=true;
	}

	__class(Sprite3DCase,'laya.ide.designplugin.Sprite3DCase',_super);
	var __proto=Sprite3DCase.prototype;
	__proto.completefun=function(sp3d){
		this._preHandle=null;
		this._preSp=sp3d.clone();
		this.addChild(this._preSp);
	}

	__proto._parse=function(data){
		_super.prototype._parse.call(this,data);
		this.url=data.url;
	}

	__getset(0,__proto,'url',_super.prototype._$get_url,function(path){
		var _$this=this;
		if(!path){
			return;
		}
		this.kk=path;
		if (this._preHandle){
			this._preHandle.clear();
			this._preHandle=null;
		}
		if (this._preSp){
			this._preSp.removeSelf();
			this._preSp=null;
		};
		var sp3d;
		this._preHandle=Handler.create(this,function(data){
			_$this.completefun(data);
		});
		Sprite3D.load(IDEAPIS.assetsPath+'/'+path,this._preHandle);
	});

	return Sprite3DCase;
})(Sprite3D)


/**
*...
*@author zyh
*/
//class laya.ide.designplugin.menu.EditMenu extends laya.display.Sprite
var EditMenu=(function(_super){
	function EditMenu(){
		this._tab=null;
		this._oldIndex=0;
		this._skins=['view/move_bottom_left.png','view/move_bottom_right.png','view/move_top_left.png','view/move_top_right.png'];
		this._target=null;
		this._isShowTarget=false;
		EditMenu.__super.call(this);
		this.init();
	}

	__class(EditMenu,'laya.ide.designplugin.menu.EditMenu',_super);
	var __proto=EditMenu.prototype;
	__proto.setOldIndex=function(){
		this._tab.selectedIndex=this._oldIndex;
	}

	__proto.setTarget=function(target){
		this._target=target;
	}

	__proto.init=function(){
		this.graphics.drawTexture(Loader.getRes("view/bg_content.png"),0,0,208,40);
		this._tab=new Tab();
		this._tab.initItems();
		var i=0;
		var btn;
		for (i=0;i < this._skins.length;i++){
			btn=new Button(this._skins[i]);
			btn.stateNum=2;
			btn.x=i *44+8;
			this._tab.addItem(btn);
		}
		this.addChild(this._tab);
		this._tab.on("change",this,this.onTabChange);
	}

	__proto.onTabChange=function(){
		if (!this._target)
			return
		if (this._isShowTarget){
			this._target.active=this._isShowTarget;
			this._isShowTarget=false;
		}
		switch(this._tab.selectedIndex){
			case MenuEnum.EDIT_PATTERN_MOVE_STAGE:
				EditerCameraScript.isTranslationPattern=true;
				this._isShowTarget=this._target.active;
				this._target.active=false;
				break ;
			case MenuEnum.EDIT_PATTERN_MOVE_OBJECT:
				this._target.positionSprite3D.active=true;
				this._target.rotationSprite3D.active=false;
				this._target.scaleSprite3D.active=false;
				EditerCameraScript.isTranslationPattern=false;
				break ;
			case MenuEnum.EDIT_PATTERN_ROTATE_OBJECT:
				this._target.positionSprite3D.active=false;
				this._target.rotationSprite3D.active=true;
				this._target.scaleSprite3D.active=false;
				EditerCameraScript.isTranslationPattern=false;
				break ;
			case MenuEnum.EDIT_PATTERN_SCALE_OBJECT:
				this._target.positionSprite3D.active=false;
				this._target.rotationSprite3D.active=false;
				this._target.scaleSprite3D.active=true;
				EditerCameraScript.isTranslationPattern=false;
				break ;
			}
	}

	__getset(0,__proto,'selectedIndex',function(){
		return this._tab.selectedIndex;
		},function(value){
		if (this._tab.selectedIndex !=value){
			this._oldIndex=this._tab.selectedIndex;
			this._tab.selectedIndex=value;
		}
	});

	__getset(1,EditMenu,'I',function(){
		return EditMenu._i=EditMenu._i|| new EditMenu();
	},laya.display.Sprite._$SET_I);

	EditMenu._i=null;
	return EditMenu;
})(Sprite)


/**
*...
*@author zyh
*/
//class laya.ide.designplugin.core.EditorCamera extends laya.d3.core.Camera
var EditorCamera=(function(_super){
	function EditorCamera(aspectRatio,nearPlane,farPlane){
		(aspectRatio===void 0)&& (aspectRatio=0);
		(nearPlane===void 0)&& (nearPlane=0.3);
		(farPlane===void 0)&& (farPlane=1000);
		EditorCamera.__super.call(this,aspectRatio,nearPlane,farPlane);
	}

	__class(EditorCamera,'laya.ide.designplugin.core.EditorCamera',_super);
	var __proto=EditorCamera.prototype;
	__getset(0,__proto,'skyboxMaterial',function(){
		return Laya.superGet(Camera,this,'skyboxMaterial');
		},function(value){
	});

	return EditorCamera;
})(Camera)


/**
*...
*@author ww
*/
//class laya.ide.designplugin.EditerScene3DPluginDemo extends editor.DesignPlugin
var EditerScene3DPluginDemo=(function(_super){
	function EditerScene3DPluginDemo(){
		this.camera=null;
		this.cameraScript=null;
		this.treeData=null;
		this.assetsPath=null;
		this.renderTargetCamera=null;
		this.editMenu=null;
		this.shader=null;
		this.renderSizeWidth=0;
		this.renderSizeHeight=0;
		this.lastX=NaN;
		this.lastY=NaN;
		this.curX=NaN;
		this.curY=NaN;
		this.delX=NaN;
		this.delY=NaN;
		this.editerScene=null;
		this.transformSprite3D=null;
		this.editer3DUtils=null;
		this._curSelectID=0;
		this.curSelectObj=null;
		this._curSelectSprite=null;
		this.selectCameraRenderSprite=null;
		this.selectCameraRenderTexture=null;
		this._isChange=false;
		this._compIDs=null;
		this._isAltDown=false;
		this._typeMap={};
		// 名字与类的对应关系，
		this._sceneMesh=null;
		this._worldCentreDistance=NaN;
		this._selectInput=null;
		this._selectCamera=null;
		this._selectCameraTexture=null;
		//根据treedata渲染场景
		this.sceneID=0;
		//lightmaps
		this.curTransformType=null;
		this.keyBoardIsOk=true;
		EditerScene3DPluginDemo.__super.call(this);
		this.changeMatId=[];
		this._pixels=new Uint8Array();
		this._vector4=new Vector4$1();
		this.sprite3dObjects=new Object();
		this.vector=new Vector3$1();
		this.tempV=new Vector2$1();
		this.curPos=new Vector2$1();
		this.delPos=new Vector2$1();
		this.delPosNormalize=new Vector2$1();
		this.lastPos=new Vector2$1();
		this.__transform=new Vector3$1();
		this.pointA=new Vector3$1();
		this.pointB=new Vector3$1();
		this._typeMap['SimpleShape']=SimpleShape;
		Stat.show(200);
		this.editerScene=new EditerScene3D(this);
		this.editer3DUtils=Editer3DUtils.I;
		this.editer3DUtils.setOwner(this);
		this.assetsPath=IDEAPIS.assetsPath;
		this._sceneMesh=this.addChild(new SceneMeshLine3D(0.1));
		this.editMenu=Laya.stage.addChild(EditMenu.I);
		this.camera=this.addChild(new Camera(0,0.1,1000));
		this.camera.transform.position=new Vector3$1(0,0,-5);
		this.camera.transform.rotate(new Vector3$1(0,180,0),false,false);
		this.camera.clearColor=new Vector4$1(0.25,0.25,0.25,0);
		this.renderTargetCamera=this.addChild(this.camera.clone());
		this.renderTargetCamera.renderingOrder=-1;
		this.renderTargetCamera.enableRender=false;
		this.renderTargetCamera.clearColor=new Vector4$1(0.0,0.0,0.0,0.0);
		this.cameraScript=this.camera.addComponent(EditerCameraScript);
		this.cameraScript.scene=this.editerScene;
		this.cameraScript.updateWorldCentreDistance=new Handler(this,this.updateWorldCentreDistance);
		this.cameraScript.saveCameraInfoHandler=new Handler(Editer3DUtils.I,Editer3DUtils.I.saveCameraInfo);
		this.transformSprite3D=this.editerScene.transformSprite3D;
		this.transformSprite3D.curCamera=this.camera;
		this.editMenu.setTarget(this.transformSprite3D);
		this.editMenu.selectedIndex=MenuEnum.EDIT_PATTERN_MOVE_OBJECT;
		this.on("display",this,this.addEvents);
		this.on("undisplay",this,this.removeEvents,[true]);
		var attributeMap={'a_Position':0};
		var uniformMap={'u_MvpMatrix':[Sprite3D.MVPMATRIX,2],'u_PickColor':[RenderableSprite3D.PICKCOLOR,2]};
		var vs="attribute vec4 a_Position;\nuniform mat4 u_MvpMatrix;\n\nvoid main()\n{\n  gl_Position = u_MvpMatrix * a_Position;\n}";
		var ps="#ifdef HIGHPRECISION\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform vec4 u_PickColor;\n\nvoid main()\n{\n  gl_FragColor = u_PickColor; \n}\n\n";
		this.shader=Shader3D.add("color",attributeMap,uniformMap);
		this.shader.addShaderPass(vs,ps);
		if (!this.selectCameraRenderSprite){
			this.updateCameraRender();
		}
		this.selectCameraRenderSprite.visible=false;
		this.onResize();
		this.editer3DUtils.regNodeDataCreater();
	}

	__class(EditerScene3DPluginDemo,'laya.ide.designplugin.EditerScene3DPluginDemo',_super);
	var __proto=EditerScene3DPluginDemo.prototype;
	__proto.updateCameraRender=function(){
		if (!this.selectCameraRenderSprite){
			this.selectCameraRenderSprite=new Image("view/bg_content.png");
			this.selectCameraRenderSprite.sizeGrid='5,5,5,5';
			var l=new Label("Camera Preview");
			l.color='#c0c0c0';
			l.fontSize=13;
			l.align='center';
			l.left=0;
			l.right=0;
			l.y=5;
			this.selectCameraRenderSprite.addChild(l);
			l=new Label('x');
			l.color='#c0c0c0';
			l.fontSize=13;
			l.centerX=0;
			l.y=26;
			this.selectCameraRenderSprite.addChild(l);
			var i=new TextInput(''+EditerScene3DPluginDemo._selectCameraW);
			i.skin='comp/input_22.png';
			i.color='#c0c0c0';
			i.fontSize=13;
			i.align='center';
			i.width=40;
			i.y=22;
			i.centerX=-25;
			this.selectCameraRenderSprite.addChild(i);
			i.on("focus",this,this.inputChange,[true]);
			i.on("blur",this,this.cameraRenderChange,[true]);
			i=new TextInput(''+EditerScene3DPluginDemo._selectCameraH);
			i.skin='comp/input_22.png';
			i.color='#c0c0c0';
			i.fontSize=13;
			i.align='center';
			i.width=40;
			i.y=22;
			i.centerX=25;
			this.selectCameraRenderSprite.addChild(i);
			i.on("focus",this,this.inputChange,[false]);
			i.on("blur",this,this.cameraRenderChange,[false]);
			Laya.stage.addChild(this.selectCameraRenderSprite);
		}
		this.selectCameraRenderSprite.width=EditerScene3DPluginDemo._selectCameraW+6;
		this.selectCameraRenderSprite.height=EditerScene3DPluginDemo._selectCameraH+54;
		if (!this.selectCameraRenderTexture){
			this.selectCameraRenderTexture=this.selectCameraRenderSprite.addChild(new Sprite());
		}
		this.selectCameraRenderTexture.pos(3,50);
	}

	__proto.inputChange=function(isW,e){
		this._selectInput=e;
	}

	__proto.cameraRenderChange=function(isW,e){
		var num=parseInt((e).text);
		var info=this.treeData.root.cameraInfo || {};
		if (isW){
			this.selectCameraRenderSprite.width=num+6;
			if (EditerScene3DPluginDemo._selectCameraW==num)
				return
			EditerScene3DPluginDemo._selectCameraW=num;
			info.renderW=num;
			}else{
			if (EditerScene3DPluginDemo._selectCameraH==num)
				return
			this.selectCameraRenderSprite.height=num+54;
			EditerScene3DPluginDemo._selectCameraH=num;
			info.renderH=num;
		}
		this.selectCameraRenderSprite.pos(this.renderSizeWidth-this.selectCameraRenderSprite.width,this.renderSizeHeight-this.selectCameraRenderSprite.height);
		if (this._selectCamera){
			this._selectCamera.renderTarget && this._selectCamera.renderTarget.destroy();
			this._selectCamera.renderTarget=new RenderTexture(EditerScene3DPluginDemo._selectCameraW,EditerScene3DPluginDemo._selectCameraH,0);
			this.cameraRender(this._selectCamera);
			this._selectCameraTexture=new Texture(this._selectCamera.renderTarget,null,EditerScene3DPluginDemo._selectCameraW,EditerScene3DPluginDemo._selectCameraH);
			this.selectCameraRenderTexture.graphics.drawImage(this._selectCameraTexture);
		}
	}

	__proto.updateSceneMesh=function(){
		var distance=Vector3$1.distance(this.camera.transform.position,Vector3$1.ZERO);
		var scale=this._sceneMesh.transform.scale;
		var pow=0;
		if (distance <=1){
			pow=0;
			}else if (distance <=25){
			pow=1;
			}else if (distance <=200){
			pow=2;
			}else{
			pow=3;
		}
		Vector3$1.scale(Vector3$1.ONE,Math.pow(10,pow),scale);
		this._sceneMesh.transform.scale=scale;
	}

	__proto.test=function(e){
		console.log(e.target);
	}

	__proto.addEvents=function(isSelect){
		Laya.stage.on("resize",this,this.onResize);
		if (isSelect){
			Laya.stage.on("keydown",this,this.onKeyDown);
			Laya.stage.on("keyup",this,this.onKeyUp);
			Laya.stage.on("mouseup",this,this.onMouseUp);
			Laya.stage.on("rightmouseup",this,this.onRightMouseUp);
			Laya.stage.on("mousedown",this,this.onMouseDown);
			Laya.stage.on("rightmousedown",this,this.onRightMouseDown);
			Notice.listen("DELETE_SELECTED",this,this.deleteSelected);
			Notice.listen("SAVE_PAGE",this,this.onSavePage,null,true);
			Notice.listen("Change_Material",this,this.changeMaterial,null,true);
			Notice.listen("Display_multiSelected",this,this.displayMultiselected);
		}
		if (this._selectCamera){
			this.selectCameraRenderSprite.visible=true;
		}
	}

	__proto.removeEvents=function(isUndisplay){
		Laya.stage.off("mousedown",this,this.test);
		Laya.stage.off("click",this,this.onClick);
		Laya.stage.off("resize",this,this.onResize);
		Laya.stage.off("mouseup",this,this.onMouseUp);
		Laya.stage.off("keydown",this,this.onKeyDown);
		Laya.stage.off("doubleclick",this,this.onDoubleClick);
		Laya.stage.off("rightmouseup",this,this.onRightMouseUp);
		Laya.stage.off("mousedown",this,this.onMouseDown);
		Laya.stage.off("rightmousedown",this,this.onRightMouseDown);
		Notice.cancel("SAVE_PAGE",this,this.onSavePage);
		Notice.cancel("DELETE_SELECTED",this,this.deleteSelected);
		Notice.cancel("Change_Material",this,this.changeMaterial);
		Notice.cancel("Display_multiSelected",this,this.displayMultiselected);
		if (!this._selectCamera){
			this.selectCameraRenderSprite.visible=false;
			Laya.timer.clear(this,this.updateCameraSprite);
		}
		if (isUndisplay){
			this.selectCameraRenderSprite.visible=false;
		}
	}

	__proto.onSavePage=function(data){
		var mat;
		var i=0;
		var j=0;
		var mats;
		var nodeObject;
		var meshSprite3d;
		var compId=0;
		this.fresh(false);
		this.changeMatId.length=0;
	}

	/*private function freshCurview():void{
	//onSavePage(null);
}*/


__proto.displayMultiselected=function(compIDs){
	this._compIDs=compIDs;
	this.designer.updateSelect(compIDs);
}


__proto.updateWorldCentreDistance=function(value){
	this.worldCentreDistance=value;
}


__proto.onDoubleClick=function(){
	console.log("DesignPluginDemo onDoubleClick");
	this.designer.goToRoot();
}


__proto.onClick=function(){
	console.log("DesignPluginDemo onClick");
}


__proto.deleteSelected=function(){
	Laya.timer.callLater(this,this.callLaterHandler);
}


__proto.callLaterHandler=function(){
	if (this.curSelectID){
		var i=0,l=this._compIDs?this._compIDs.length:0;
		var delteID=0;
		for (;i < l;i++){
			delteID=this._compIDs[i];
			this.treeData.removeSelf(this.treeData.getNodeByID(delteID));
			(this.sprite3dObjects [delteID]).removeSelf();
		}
		if (!l){
			this.treeData.removeSelf(this.treeData.getNodeByID(this.curSelectID));
			(this.sprite3dObjects [this.curSelectID]).removeSelf();
		}
		this.transformSprite3D && (this.transformSprite3D.active=false);
		var deleteScene=false;
		if (this.curSelectID==this.sceneID){
			deleteScene=true;
			this.sceneID=0;
		}
		this.curSelectID=0;
		this.fresh(true,deleteScene);
	}

}


__proto.changeMaterial=function(compId,index,prop,data){
	var sprite3d=this.sprite3dObjects[compId];
	var mat=sprite3d.meshRenderer.materials[index];
	if (prop=="albedoColor"){
		var color=mat[prop];
		color.fromArray(data);
		mat[prop]=color;
	}

	else if (prop=="albedoTexture"){
		Texture2D.load(data,Handler.create(this,function(text){
			mat[prop]=text;
		}));
	}

	if (this.changeMatId.indexOf(compId)==-1){
		this.changeMatId.push(compId);
	}

	this.designer.changeXml(this.treeData.root,false);
}


__proto.addTemplate=function(tempName,x,y,z){
	var tempFile=laya.ide.managers.FileManager.getAppPath('renders/publicres/3DObjTemplate/'+tempName+'.json');
	var objtemp=laya.ide.managers.FileManager.readJSONFile(tempFile);
	if (objtemp){
		var cls=this._typeMap[tempName];
		if (cls){
			var obj=new cls(objtemp);
			this.addChild(obj);
			this.treeData.addChild(objtemp,this.treeData.getNodeByID(this.sceneID));
			this.treeData.freshData();
		}
	}

}


/**
*资源拖拽事件
*@param e
*@param x
*@param y
*@param parentId
*@param index
*@param absPos
*/
__proto.onDragDrop=function(e,x,y,parentId,index,absPos){
	(x===void 0)&& (x=-1);
	(y===void 0)&& (y=-1);
	(parentId===void 0)&& (parentId=-1);
	(index===void 0)&& (index=-1);
	(absPos===void 0)&& (absPos=false);
	var url=e._data.asset;
	var lhSubPath="";
	var lhData;
	if (url==''){
		type=e._data.compType;
		lhData=this.editer3DUtils.createSpriteJsonData(type);
		}else{
		var prefab=laya.ide.managers.FileManager.getRelativePath(this.assetsPath,url);
		var paths=prefab.split('/');
		for (var i=0;i < paths.length-1;i++){
			lhSubPath+=paths[i]+"/";
		};
		var types=(paths [paths.length-1]).split(".");
		var type=types[types.length-1];
		switch(type){
			case 'ls':
			case 'lh':
				lhData=laya.ide.managers.FileManager.readJSONFile(url).data;
				this.editer3DUtils.updatePrefaFile(lhData,lhSubPath,'',prefab);
				break ;
			case 'prefab':
				lhData=this.designer.getAddPrefabData(url);
				break ;
			default :
				return;
			}
		type=lhData.type;
	};

	var msg='';
	if (type=='Scene3D'){
		msg='Can not add Scene3D in Scene3D';
		}else if(IDEAPIS.getCompConfigProp(type,'is3DNode')!="true"){
		msg='Can not add Scene3D in '+type;
	}

	if (msg !=''){
		laya.editor.manager.MessageManager.instance.show(msg);
		return
	}

	this.editer3DUtils.updateLayaScene3dFile(lhData,lhSubPath);
	var pID=parentId;
	if (pID==-1 || pID==this.treeData.root.compId){
		if(this.sceneID)
			pID=this.sceneID;
		else
		pID=this.treeData.root.compId;
	}

	this.treeData.addChild(lhData,this.treeData.getNodeByID(pID));
	this.fresh();
}


//属性改变通知，
__proto.changeProps=function(proName,pro,targetID,cache,ifRefreshComp,propsSign){
	(targetID===void 0)&& (targetID=-1);
	(cache===void 0)&& (cache=true);
	(ifRefreshComp===void 0)&& (ifRefreshComp=true);
	(propsSign===void 0)&& (propsSign="props");
	var v3;
	console.log("changeProps:",proName,pro,targetID,cache,ifRefreshComp,propsSign);
	var sprite3d=this.sprite3dObjects[targetID];
	switch(proName){
		case "position":
		case "rotationEuler":
		case "scale":;
			var localProName="local"+proName.substring(0,1).toLocaleUpperCase()+proName.substring(1);
			var transform=sprite3d.transform;
			v3=transform[localProName];
			v3.fromArray(pro);
			transform[localProName]=v3;
			if (proName !="scale")
				this.transformSprite3D.transform[localProName]=v3;
			break ;
		case "center":
		case "size":
			v3=sprite3d[proName];
			v3.fromArray(pro);
			sprite3d[proName]=v3;
			break ;
		case "color":
		case "clearColor":
		case "ambientColor":
		case "fogColor":;
			var color=sprite3d[proName];
			color.fromArray(pro);
			sprite3d[proName]=color;
			break ;
		case "viewport":
			sprite3d.normalizedViewport=new Viewport(pro[0],pro[1],pro[2],pro[3]);
			break ;
		default :
			if(sprite3d.hasOwnProperty(proName))
				sprite3d[proName]=pro;
			else
			sprite3d.comXml.props[proName]=pro;
			break ;
		}
	if (this['$_GID']==sprite3d['$_GID'])
		sprite3d.comXml.props[proName]=pro;
	((sprite3d instanceof laya.d3.core.Camera ))&& this.cameraRender(sprite3d);
	cache && this.designer.changeXml(this.treeData.root,false);
	this.fresh(false);
}


__proto.selectByID=function(id){
	if (this.curSelectID==id)
		return
	console.log("DesignPluginDemo selectByID:",id);
	this.designer.updateSelect([id]);
	this.curSelectID=id;
	this.curSelectObj=this.treeData.getNodeByID(this.curSelectID);
	if (!this.curSelectObj){
		this.curSelectID=0;
		return
	}

	this.curSelectSprite=this.sprite3dObjects[this.curSelectID];
	var t=this.curSelectSprite.transform;
	if (t){
		var t2=this.transformSprite3D.transform;
		t.position.cloneTo(t2.position);
		t2.position=t2.position;
		t.rotation.cloneTo(t2.rotation);
		t2.rotation=t2.rotation;
		var type=this.curSelectObj.type;
		if (IDEAPIS.getCompConfigProp(type,'isScript')!='true'){
			var distance=Vector3$1.distance(this.camera.transform.position,t.position);
			this.vector.x=this.vector.y=this.vector.z=distance *0.25;
			t2.scale=this.vector;
			this.transformSprite3D.active=true;
			}else if (IDEAPIS.getCompConfigProp(type,'isShape')=='true'){
			this.transformSprite3D.active=true;
			}else{
			this.transformSprite3D.active=false;
		}
		}else{
		this.transformSprite3D.active=false;
	}

	Notice.notify("PROPPANEL_SETBY_NODEOBJ",[this.designer.getCompOById(id),id]);
	Notice.notify("DISPLAY_TREE_SELECTITEMS",[[this.treeData.getNodeByID(id)]]);
	if ((this.curSelectSprite instanceof laya.d3.core.Camera )){
		if (!this.selectCameraRenderSprite.visible){
			this.selectCameraRenderSprite.visible=true;
			this._selectCamera=this.curSelectSprite;
			this._selectCamera.renderTarget && this._selectCamera.renderTarget.destroy();
			this._selectCamera.renderTarget=new RenderTexture(EditerScene3DPluginDemo._selectCameraW,EditerScene3DPluginDemo._selectCameraH,0);
			this.cameraRender(this._selectCamera);
			this._selectCameraTexture=new Texture(this._selectCamera.renderTarget,null,EditerScene3DPluginDemo._selectCameraW,EditerScene3DPluginDemo._selectCameraH);
			this.selectCameraRenderTexture.graphics.drawImage(this._selectCameraTexture);
			Laya.timer.loop(16,this,this.updateCameraSprite);
		}
	}

}


__proto.cameraRender=function(camera){
	var isShow=false;
	if (this.transformSprite3D.active){
		isShow=true;
		this.transformSprite3D.active=false;
	}

	this._sceneMesh.active=false;
	camera.render();
	if (isShow){
		this.transformSprite3D.active=true;
	}

	this._sceneMesh.active=true;
}


__proto.updateCameraSprite=function(){
	if (this._isChange && this.keyBoardIsOk){
		this.cameraRender(this._selectCamera);
		this.selectCameraRenderTexture.graphics.clear();
		this.selectCameraRenderTexture.graphics.drawImage(this._selectCameraTexture);
	}

}


__proto.setData=function(dataO,hasSelfData){
	(hasSelfData===void 0)&& (hasSelfData=true);
	console.log("DesignPluginDemo setData:",dataO);
	this.treeData=(this.designer)._treeData;
	if (hasSelfData){
		this.sceneID=dataO.compId;
		this.sprite3dObjects[this.sceneID]=this;
		var info=this.treeData.root.cameraInfo;
		if (info && info.position && info.rotation){
			var transform=this.camera.transform;
			var position=transform.position;
			var rotation=transform.rotation;
			position.fromArray(info.position);
			rotation.fromArray(info.rotation);
			transform.position=position;
			transform.rotation=rotation;
			if (info.renderW)
				EditerScene3DPluginDemo._selectCameraW=info.renderW;
			if (info.renderH)
				EditerScene3DPluginDemo._selectCameraH=info.renderH;
			this.updateCameraRender();
		}
		if(this.setProperty(dataO))
			this.editer3DUtils.createSceneByJsonData(dataO);
		}else{
		this.removeChildren(5);
		this.sprite3dObjects[dataO.compId]=this.addChild(this.editer3DUtils.createSpriteByJsonData(dataO));
	}

	if (!this.worldCentreDistance || isNaN(this.worldCentreDistance)){
		Vector3$1.ZERO.cloneTo(this.vector);
		this.worldCentreDistance=Vector3$1.distance(this.camera.transform.position,this.vector);
		}else if (isNaN(this.cameraScript.worldCentreDistance)){
		this.cameraScript.worldCentreDistance=this._worldCentreDistance
	}

}


__proto.setIDESelectState=function(_isSelect){
	EditerCameraScript.isSelect=_isSelect;
	this.removeEvents(false);
	if (_isSelect){
		this.addEvents(true);
	}

	console.log("DesignPluginDemo setIDESelectState:",_isSelect);
}


__proto.isMouseHit=function(){
	var mX=NaN;
	var mY=NaN;
	mX=this.mouseX;
	mY=this.mouseY;
	return mX < this.width && mY < this.height;
}


//粘贴
__proto.pasteComp=function(copyTemp,samePoint){
	var parent=(this.designer._selectedBox).comXml;
	var obj;
	for(var $each_obj in copyTemp){
		obj=copyTemp[$each_obj];
		var temp=obj.xml;
		var newXml=ObjectTools.copyObj(temp);
		if(this.designer.isPrefabFile)
			laya.editor.manager.PreFabManager.I.makeNodeOkForPrefabFile(newXml,this.designer._xml);
		newXml.compId=this.designer._autoId++;
		this.designer.makeVarOK(newXml);
		IDEAPIS.pasteNodeNotice(newXml);
		parent.child.push(newXml);
	}

	this.designer.changeXml(this.designer._xml);
	this.designer.clearSelect();
}


//刷新场景，保存文件
__proto.fresh=function(depth,deleteScene){
	(depth===void 0)&& (depth=true);
	(deleteScene===void 0)&& (deleteScene=false);
	this.treeData.freshData();
	var obj=this.treeData.getNodeByID(this.sceneID);
	if (obj){
		depth && this.setData(obj);
		if (this.curSelectID)
			this.selectByID(this.curSelectID);
		else
		this.selectByID(this.sceneID);
	}

	if(depth)
		this.designer.changeXml(this.treeData.root,deleteScene);
	Notice.notify("SHOW_DISPLAY_TREE",this.treeData);
	Notice.notify("DESIGN_DATACHANGED");
}


__proto.onResize=function(e){
	this.renderSizeWidth=RenderContext3D.clientWidth;
	this.renderSizeHeight=RenderContext3D.clientHeight;
	this.size(this.renderSizeWidth,this.renderSizeHeight);
	this.renderTargetCamera.renderTarget && this.renderTargetCamera.renderTarget.destroy();
	this.renderTargetCamera.renderTarget=new RenderTexture(this.renderSizeWidth,this.renderSizeHeight,0);
	this.selectCameraRenderSprite.pos(this.renderSizeWidth-this.selectCameraRenderSprite.width,this.renderSizeHeight-this.selectCameraRenderSprite.height);
	this._pixels=new Uint8Array(this.renderSizeWidth *this.renderSizeHeight *4);
}


__proto.setProperty=function(data){
	var _$this=this;
	var obj;
	var props=data.props;
	var key;
	if (props.preset){
		props={};
		obj=data.props;
		for (key in obj){
			props[key]=obj[key];
		}
		obj=laya.editor.manager.PreFabManager.I.getPreFabByNode(data).props;
		for (key in obj){
			if (props[key]==undefined)
				props[key]=obj[key];
		}
	}

	if (props.prefabPath){
		if (!props.preset){
			props={};
			obj=data.props;
			for (key in obj){
				props[key]=obj[key];
			}
		}
		obj=PrefabManager.I.getPreFabByNode(data,props,Editer3DUtils.I._owner.designer.isPrefabFile)
		if (obj){
			obj=obj.props;
			for (key in obj){
				if (props[key]==undefined)
					props[key]=obj[key];
			}
			if (PrefabManager.I.isFresh){
				PrefabManager.I.isFresh=false;
				this.fresh();
				laya.editor.manager.ShortcutManager.exeKey(83,true);
			}
			}else{
			return false;
		}
	}

	if (props.lightmaps){
		var i=0,l=props.lightmaps.length;
		obj;
		var index=0;
		var v=[];
		for (i=0;i < l;i++){
			obj=props.lightmaps[i];
			Texture2D.load(this.assetsPath+'/'+props['lhSubPath']+obj.path,Handler.create(this,function(_i,e){
				v[_i]=e;
				index++;
				if (index==l){
					_$this.setlightmaps(v);
				}
			},[i]));
		}
	};

	var str;
	var prop;
	for (str in props){
		prop=props[str];
		switch(str){
			case "ambientColor":
			case "fogColor":
				this.vector.fromArray(prop);
				prop=this.vector.clone();
				break ;
			}
		if (str=='lightmaps' ||
			str=='position' ||
		str=='rotation')
		continue
		this[str]=prop;
	}

	return true;
}


__proto.onMouseDown=function(e){
	if (!e.target.scene || EditerCameraScript.isTranslationPattern)
		return;
	this.renderTargetCamera.transform.worldMatrix=this.camera.transform.worldMatrix;
	this._sceneMesh.active=false;
	this.renderTargetCamera.render(this.shader);
	this._sceneMesh.active=true;
	var pickSprite=this.pickSpriteByPickColors(e.stageX,e.stageY);
	var name;
	if (pickSprite){
		this.transformSprite3D.reFresh();
		if (pickSprite.comXml){
			this.selectByID(pickSprite.comXml.compId);
			this.curSelectSprite=pickSprite;
			}else if(this.curSelectSprite && this.curSelectSprite.transform){
			this.curTransformType=pickSprite.name;
			switch (this.curTransformType){
				case 'PositionX':
					this.vector=this.curSelectSprite.transform.right;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.positionX);
					break ;
				case 'PositionY':
					this.vector=this.curSelectSprite.transform.up;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.positionY);
					break ;
				case 'PositionZ':
					this.vector=this.curSelectSprite.transform.forward;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.positionZ);
					break ;
				case 'RotationX':
					this.vector=this.curSelectSprite.transform.up;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.rotationX);
					break ;
				case 'RotationY':
					this.vector=this.curSelectSprite.transform.right;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.rotationY);
					break ;
				case 'RotationZ':
					this.vector=this.curSelectSprite.transform.up;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.rotationZ);
					break ;
				case 'ScaleX':
					this.vector=this.curSelectSprite.transform.right;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.scalingX);
					break ;
				case 'ScaleY':
					this.vector=this.curSelectSprite.transform.up;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.scalingY);
					break ;
				case 'ScaleZ':
					this.vector=this.curSelectSprite.transform.forward;
					this.transformSprite3D.onSelectChangeColor(this.transformSprite3D.scalingZ);
					break ;
				default :
					break ;
				}
			this.camera.worldToViewportPoint(this.curSelectSprite.transform.position,this.pointA);
			Vector3$1.add(this.curSelectSprite.transform.position,this.vector,this.vector);
			this.camera.worldToViewportPoint(this.vector,this.pointB);
			this.tempV.x=this.pointB.x-this.pointA.x;
			this.tempV.y=this.pointB.y-this.pointA.y;
			Vector2$1.normalize(this.tempV,this.tempV);
			Laya.stage.on("mousemove",this,this.onMouseMove,[false]);
		}
		}else if(this.sceneID && this.curSelectID !=this.sceneID){
		this.selectByID(this.sceneID);
		if(!this._isAltDown)
			this.transformSprite3D.active=false;
	}

	this.lastX=e.stageX;
	this.lastY=e.stageY;
}


__proto.onMouseMove=function(isRight,e){
	this._isChange=true;
	if(isRight || this.curSelectID==this.sceneID)
		return
	this.curX=e.stageX;
	this.curY=e.stageY;
	this.delPos.x=(this.lastX-this.curX);
	this.delPos.y=(this.lastY-this.curY);
	Vector3$1.ZERO.cloneTo(this.__transform);
	Vector2$1.normalize(this.delPos,this.delPosNormalize);
	var radius=Math.acos(Vector2$1.dot(this.delPosNormalize,this.tempV));
	var length=Vector2$1.scalarLength(this.delPos);
	var positionRatio=0.01;
	var rotationRatio=0.008;
	var scaleRatio=0.004;
	var offset=length *Math.cos(radius);
	var props=this.curSelectObj.props;
	var transform=this.curSelectSprite.transform;
	switch (this.curTransformType){
		case 'PositionX':
			this.__transform.x=-offset *positionRatio;
			transform.translate(this.__transform);
			this.transformSprite3D.transform.translate(this.__transform);
			if (props.center){
				props.center[0]=transform.localPosition.x;
				}else{
				if (!props.position)
					props.position=[0,0,0];
				props.position[0]=transform.localPosition.x;
			}
			break ;
		case 'PositionY':
			this.__transform.y=-offset *positionRatio;
			transform.translate(this.__transform);
			this.transformSprite3D.transform.translate(this.__transform);
			if (props.center){
				props.center[1]=transform.localPosition.y;
				}else{
				if (!props.position)
					props.position=[0,0,0];
				props.position[1]=transform.localPosition.y;
			}
			break ;
		case 'PositionZ':
			this.__transform.z=offset *positionRatio;
			transform.translate(this.__transform);
			this.transformSprite3D.transform.translate(this.__transform);
			if (props.center){
				props.center[2]=transform.localPosition.z;
				}else{
				if (!props.position)
					props.position=[0,0,0];
				props.position[2]=transform.localPosition.z;
			}
			break ;
		case 'RotationX':
			this.__transform.x=offset *rotationRatio;
			transform.rotate(this.__transform);
			this.transformSprite3D.transform.rotate(this.__transform);
			if (!props.rotationEuler)
				props.rotationEuler=[0,0,0];
			props.rotationEuler[0]=transform.localRotationEuler.x;
			break ;
		case 'RotationY':
			this.__transform.y=-offset *rotationRatio;
			transform.rotate(this.__transform);
			this.transformSprite3D.transform.rotate(this.__transform);
			if (!props.rotationEuler)
				props.rotationEuler=[0,0,0];
			props.rotationEuler[1]=transform.localRotationEuler.y;
			break ;
		case 'RotationZ':
			this.__transform.z=-offset *rotationRatio;
			transform.rotate(this.__transform);
			this.transformSprite3D.transform.rotate(this.__transform);
			if (!props.rotationEuler)
				props.rotationEuler=[0,0,0];
			props.rotationEuler[2]=transform.localRotationEuler.z;
			break ;
		case 'ScaleX':
			this.__transform.x=-offset *scaleRatio;
			Vector3$1.add(transform.scale,this.__transform,transform.scale);
			transform.scale=transform.scale;
			if (!props.scale)
				props.scale=[0,0,0];
			props.scale[0]=transform.scale.x;
			break ;
		case 'ScaleY':
			this.__transform.y=-offset *scaleRatio;
			Vector3$1.add(transform.scale,this.__transform,transform.scale);
			transform.scale=transform.scale;
			if (!props.scale)
				props.scale=[0,0,0];
			props.scale[1]=transform.scale.y;
			break ;
		case 'ScaleZ':
			this.__transform.z=offset *scaleRatio;
			Vector3$1.add(transform.scale,this.__transform,transform.scale);
			transform.scale=transform.scale;
			if (!props.scale)
				props.scale=[0,0,0];
			props.scale[2]=transform.scale.z;
			break ;
		default :
			break ;
		}
	this.lastX=this.curX;
	this.lastY=this.curY;
	((this.curSelectSprite instanceof laya.d3.core.Camera ))&& (this.curSelectSprite).render();
}


//fresh(false);
__proto.onMouseUp=function(e){
	Laya.stage.off("mousemove",this,this.onMouseMove);
	if (this._isChange){
		this.designer.changeXml(this.treeData.root,false);
		Notice.notify("PROPPANEL_SETBY_NODEOBJ",[this.designer.getCompOById(this.curSelectID),this.curSelectID]);
		this._isChange=false
	}

}


__proto.pickSpriteByPickColors=function(posx,posy){
	var pixels=this._pixels;
	this.renderTargetCamera.renderTarget.getData(0,0,this.renderSizeWidth,this.renderSizeHeight,pixels);
	var tempSprite;
	var pickSprite=this.pickSpriteByPickColor(posx,posy,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+1,posy,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-1,posy,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx,posy+1,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx,posy-1,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-1,posy-1,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+1,posy-1,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-1,posy+1,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+1,posy+1,pixels);
	if (pickSprite){
		if (pickSprite.transformType){
			return pickSprite;
		}
		tempSprite=pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+2,posy,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-2,posy,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx,posy+2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx,posy-2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+2,posy-1,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+2,posy+1,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-2,posy-1,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-2,posy+1,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-1,posy+2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+1,posy+2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-1,posy-2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+1,posy-2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-2,posy-2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+2,posy-2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx-2,posy+2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	pickSprite=this.pickSpriteByPickColor(posx+2,posy+2,pixels);
	if (pickSprite && pickSprite.transformType){
		return pickSprite;
	}

	return tempSprite;
}


__proto.pickSpriteByPickColor=function(posx,posy,pixels){
	if (posx < 0 || posy < 0){
		return null;
	};

	var index=posy *this.renderSizeWidth *4+posx *4;
	this._vector4.x=pixels[index];
	this._vector4.y=pixels[index+1];
	this._vector4.z=pixels[index+2];
	this._vector4.w=1.0;
	var id=this._searchIDByPickColor(this._vector4);
	var pickSprite=this._pickIdToSprite[id];
	if (pickSprite){
		return pickSprite;
	}

	return null;
}


/**键盘按下处理*/
__proto.onKeyDown=function(e){
	if (!this.keyBoardIsOk || !IDEAPIS.isIDEDesignFocusOK()){
		return;
	}

	switch (e["keyCode"]){
		case 81:
			if (this.curSelectSprite)
				this.editMenu.selectedIndex=MenuEnum.EDIT_PATTERN_MOVE_STAGE;
			break ;
		case 87:
			if (this.curSelectSprite){
				this.editMenu.selectedIndex=MenuEnum.EDIT_PATTERN_MOVE_OBJECT;
			}
			break ;
		case 69:
			if (this.curSelectSprite){
				this.editMenu.selectedIndex=MenuEnum.EDIT_PATTERN_ROTATE_OBJECT;
			}
			break ;
		case 82:
			if (this.curSelectSprite){
				this.editMenu.selectedIndex=MenuEnum.EDIT_PATTERN_SCALE_OBJECT;
			}
			break ;
		case 70:
			if (this.curSelectSprite && this.curSelectSprite.meshRenderer && this.curSelectSprite.meshRenderer.boundingSphere){
				var target=this.vector;
				Vector3$1.scale(this.camera.transform.forward,this.curSelectSprite.meshRenderer.boundingSphere.radius*4,target);
				Vector3$1.subtract(this.curSelectSprite.transform.position,target,target);
				this.cameraScript.focusCamera(target.x,target.y,target.z);
				this.worldCentreDistance=this.curSelectSprite.meshRenderer.boundingSphere.radius *4;
			}
			break ;
		case 46:
			this.deleteSelected();
			break ;
		case 18:
			this._isAltDown=true;
			break ;
		case 13:
			this._selectInput.focus=false;
			break ;
		}
}


__proto.onKeyUp=function(){
	this._isAltDown=false;
}


__proto.onRightMouseDown=function(){
	this.keyBoardIsOk=false;
	Laya.stage.on("mousemove",this,this.onMouseMove,[true]);
}


__proto.onRightMouseUp=function(){
	this.keyBoardIsOk=true;
	Laya.stage.off("mousemove",this,this.onMouseMove);
	if (this._isChange){
		this.designer.changeXml(this.treeData.root,false);
		Notice.notify("PROPPANEL_SETBY_NODEOBJ",[this.designer.getCompOById(this.curSelectID),this.curSelectID]);
		this._isChange=false
	}

}


__getset(0,__proto,'curSelectID',function(){
	return this._curSelectID;
	},function(value){

	this._curSelectID=value;
});


__getset(0,__proto,'worldCentreDistance',function(){
	return this._worldCentreDistance;
	},function(value){

	this._worldCentreDistance=value;
	this.cameraScript.worldCentreDistance=value;
	this.updateSceneMesh();
});


__getset(0,__proto,'curSelectSprite',function(){
	return this._curSelectSprite;
	},function(value){

	if (this._curSelectSprite)
		this._curSelectSprite.event("blur");
	this._curSelectSprite=value;
	this._curSelectSprite.event("focus");
});


EditerScene3DPluginDemo._selectCameraW=240;
EditerScene3DPluginDemo._selectCameraH=160;
EditerScene3DPluginDemo.__init$=function(){
	Editer3DUtils.I.regNodeDataCreater();;;;;;
}


return EditerScene3DPluginDemo;
})(DesignPlugin)


/**
*...
*@author zyh
*/
//class laya.ide.designplugin.SceneMeshLine3D extends laya.d3.core.pixelLine.PixelLineSprite3D
var SceneMeshLine3D=(function(_super){
	function SceneMeshLine3D(gap){
		this._gap=NaN;
		this._color=Color.GRAY;
		SceneMeshLine3D.__super.call(this,1002);
		this._gap=gap;
		this.drawLine();
	}

	__class(SceneMeshLine3D,'laya.ide.designplugin.SceneMeshLine3D',_super);
	var __proto=SceneMeshLine3D.prototype;
	__proto.drawLine=function(){
		var v=250 *this._gap;
		var startPoint=new Vector3$1(-v);
		var endPoint=new Vector3$1(v);
		var pixelLineData;
		var data=[];
		var i=-250;
		for (;i < 251;i++){
			pixelLineData=new PixelLineData();
			startPoint.z=endPoint.z=this._gap *i;
			startPoint.cloneTo(pixelLineData.startPosition);
			endPoint.cloneTo(pixelLineData.endPosition);
			this._color.cloneTo(pixelLineData.startColor);
			this._color.cloneTo(pixelLineData.endColor);
			data.push(pixelLineData);
		}
		startPoint.x=endPoint.x=0;
		startPoint.z=-v;
		endPoint.z=v;
		for (i=-250;i < 251;i++){
			pixelLineData=new PixelLineData();
			startPoint.x=endPoint.x=this._gap *i;
			startPoint.cloneTo(pixelLineData.startPosition);
			endPoint.cloneTo(pixelLineData.endPosition);
			this._color.cloneTo(pixelLineData.startColor);
			this._color.cloneTo(pixelLineData.endColor);
			data.push(pixelLineData);
		}
		this.addLines(data);
	}

	return SceneMeshLine3D;
})(PixelLineSprite3D)


/**
*...
*@author laya
*/
//class laya.ide.designplugin.SimpleShape extends laya.d3Extend.worldMaker.SimpleShapeSprite3D
var SimpleShape=(function(_super){
	function SimpleShape(props){
		this._hengjiemian=null;
		this._suofang=null;
		props['isEditor']=true;
		SimpleShape.__super.call(this,props);
	}

	__class(SimpleShape,'laya.ide.designplugin.SimpleShape',_super);
	var __proto=SimpleShape.prototype;
	__getset(0,__proto,'crossSection',function(){
		return this._hengjiemian;
		},function(value){
		var y=NaN;
		var x=NaN;
		var fvalue=[];
		var ptnum=value.length / 2;
		var cx=0;
		var cy=0;
		for (var i=0;i < ptnum;i++){
			x=value[i *2];
			y=value[i *2+1];
			cx+=x;
			cy+=y;
		}
		cx /=ptnum;
		cy /=ptnum;
		for (i=0;i < ptnum;i++){
			x=value[i *2];
			y=value[i *2+1];
			fvalue.push((x-cx)/100);
			fvalue.push((y-cy)/100);
		}
		this._simpleShapeMesh.setCrossSection(fvalue);
		this._hengjiemian=value;
	});

	//}
	__getset(0,__proto,'crossSectionInterpNum',function(){
		return this._simpleShapeMesh.crossSectionInterpNum;
		},function(i){
		this._simpleShapeMesh.crossSectionInterpNum=i;
	});

	__getset(0,__proto,'profileLine',function(){
		debugger;
		return this._suofang;
		},function(value){
		var fvalue=[];
		var ptnum=value.length / 2;
		for (var i=0;i < ptnum;i++){
			var x=value[i *2];
			var y=value[i *2+1];
			fvalue.push(x / 100);
			fvalue.push((100-y)/ 100);
		}
		this._simpleShapeMesh.setProfileLine(fvalue);
		this._suofang=value;
	});

	__getset(0,__proto,'polygonStyle',function(){
		return this._simpleShapeMesh.polygonStyle;
		},function(b){
		this._simpleShapeMesh.polygonStyle=b;
	});

	__getset(0,__proto,'profileLineInterpNum',function(){
		return this._simpleShapeMesh.profileLineInterpNum;
		},function(i){
		this._simpleShapeMesh.profileLineInterpNum=i;
	});

	__getset(0,__proto,'color',function(){
		return this._simpleShapeMesh.color;
		},function(color){
		this._simpleShapeMesh.color=color;
	});

	__getset(0,__proto,'meshRenderer',function(){
		return this._render;
	});

	return SimpleShape;
})(SimpleShapeSprite3D)


	Laya.__init([EditerScene3DPluginDemo]);
})(window,document,Laya);

if (typeof define === 'function' && define.amd){
	define('laya.core', ['require', "exports"], function(require, exports) {
        'use strict';
        Object.defineProperty(exports, '__esModule', { value: true });
        for (var i in Laya) {
			var o = Laya[i];
            o && o.__isclass && (exports[i] = o);
        }
    });
}